.htaccess - Redirecting all .HTML to .PHP pages but not from one directory? -
i converted .html pages on site .php. added following code .htaccess file:
redirectmatch permanent ^(.*)\.htm(l?)$ $1.php this works fine , .html pages re-direct .php pages.
my question is, there way limit files code affects?
more stop .html , .htm pages sub domain being redirected.
shop.domain.com i have other parts of website in sub-directory of root folder need end in .html , don't want .html extensions re-direct.
is there code or way this?
add .htaccess in web root / directory.
options +followsymlinks -multiviews rewriteengine on rewritebase / rewritecond %{http_host} !^shop\.domain\.com$ [nc] rewritecond %{request_uri} !^/shop/? [nc] rewriterule ^([^/]+)\.html?$ $1.php [r=301,nc,l] this won't redirect sub-directory including shop. in case want allow (except shop) use
rewriterule ^(.+)\.html?$ $1.php [r=301,nc,l]
Comments
Post a Comment