.htaccess - URL redirections issue -
i rewriting url rules in htaccess, , use sefurl (seo friendly url's). there 1 issue,
when going link page generate seo friendly url's if going in write direct file name on there, want redirect on same url'
for example,
on page got generated url link of http://www.exampleskey.com/myfirsthtpage
using htaccess point servers myfirsthtpage.php
file
now if wrote url http://www.exampleskey.com/myfirsthtpage.php
show me same url, if 1 write above url 1 should redirect http://www.exampleskey.com/myfirsthtpage
htaccess. 1 me do.
i tried 'rewritecond' not getting proper results.
you can use code in document_root/.htaccess
file:
rewriteengine on rewritebase / # externally redirect /dir/file.php /dir/file rewritecond %{the_request} \s/+(.*?/)?(?:index)?(.*?)\.php[\s?] [nc] rewriterule ^ /%1%2 [r=302,l,ne] # internally forward /dir/file /dir/file.php rewritecond %{request_filename} !-d rewritecond %{document_root}/$1\.php -f [nc] rewriterule ^(.+?)/?$ /$1.php [l]
Comments
Post a Comment