.htaccess - Redirect URL using htaccess if it contains a directory and ends in php -
i want redirect url's such
example.com/blog/product.php to
example.com/product.php i.e. if url contains /blog , ends in .php want redirect url /blog removed.
how go doing this?
thanks
inside /blog/.htaccess can have code:
rewriteengine on rewriterule ^([^./]+)\.php$ /$1 [l,nc,r=301] if /blog/.htaccess doesn't exist in root .htaccess can have rule:
rewriterule ^blog/([^./]+)\.php$ /$1 [l,nc,r=301]
Comments
Post a Comment