Hi There, I need help with my htaccess file for redirecting. Under a folder any .htm requested has to redirected to folder index. Like ; RedirectMatch 301 folder3/*.htm$ /folder3/ And also specific htm file requested has to redirected to a php script. Like ; RedirectMatch 301 folder3/somefile.htm /folder3/script.php?details=somefilename&m=1&md=sc1 what would be the way to do it ?
Are requested .htm files exists? If not: RewriteCond /phisical/path%{REQUEST_FILENAME} !-s RewriteRule ^/folder3/(.+) /folder3/index.htm Example: You have files: /folder3/index.htm and /folder3/test.htm You can request: /folder3/index.htm and you got it /folder3/test.htm and you got it /folder3/nonexist.htm and you got index.htm Or if you want to redirect all (if file exist or not): RewriteRule ^/folder3/(.+).htm /folder3/ I think... not tested Based on VirtualHost directive, but i think in .htaccess can work.
Actually, some htm files would exist and some would not. This is why I wanted redirect. Engines will have to update the links.. Redirect....
Sir i have a very simple question i have a website and its in php i have use the redirect engine to show extension as html insteade of php but in my site all links and stuff r in php and its now hard to chaneg each link to html so can u let meknow how to do that in htaccess here is my htaccess code Options +FollowSymLinks RewriteEngine On RewriteRule ^([^.]+).html$ /$1.php [QSA,L] its work fine if some one type mysitename.com/index.php works and mysitenamev.com/index.html works fine but i want when a type .php so it iwll automatically redirect to respective html file please help me asap
in htaccess I have RewriteEngine On RewriteBase / RewriteRule ^([^/]+)/$ details.php?content=$1 [L] Code (markup): to make the urls from domain.com/details.php?content=aboutus to domain.com/aboutus it does not work. I had RewriteRule ^/(.+) /details.php?content=$1 Code (markup): before.. didnt work either.. Any idea why ?