.htaccess - Apache server loads page instead of applying rewrite rule -
i'm trying make website add trailing slash , rewrite uri html page. redirect xy.com/abc xy.com/abc/, , load xy.com/abc.html.
my .htaccess file looks this:
rewriteengine on rewritebase / rewriterule ^([a-z]+)$ $1/ [r] rewriterule ^([a-z]+)/$ $1.html [l] when try going xy.com/asd (non-existing page) redirects xy.com/asd/ , gives me proper 404 error.
when try page exists (xy.com/about), loads xy.com/about.html without redirecting @ all.
try code:
options -multiviews rewriteengine on rewritebase / rewriterule ^([a-z]+)$ $1/ [r,nc,l] rewritecond %{document_root}/$1.html -f rewriterule ^([a-z]+)/$ $1.html [l,nc]
Comments
Post a Comment