Apache

Following rule will replace old-directory with new-directory in your website's URL. Add this to .htaccess file.


Options +FollowSymLinks
RewriteEngine On
RewriteRule ^old-directory(.*)$ http://www.yourdomain.com/new-directory$1 [l,r=301,nc]

Syntax:

rewriterule - defines rewrite rule
^ - start matching
(.*) - match and remember everything
$ - end matching
$1 - append original URL part captured in (.*)
l - last rule (only omit in linked rules)
r=301 - redirect using 301 response (permanent redirect)
[nc] - non case sensitive

 

 

No comments

Leave your comment

In reply to Some User
Captcha Image