开发者

htaccess redirect wordpress folder change

开发者 https://www.devze.com 2023-02-22 08:37 出处:网络
I currently have a url of http://example.com/wordpres/ I\'m going to change this to http://example.com/w/

I currently have a url of http://example.com/wordpres/ I'm going to change this to http://example.com/w/ I currently get a lot of traffic from links already out on the web. How can开发者_JS百科 I redirect everything that went to /wordpress to /w ?


RedirectMatch 301 ^wordpress(.*)$ /directory/path/to/w/$1

The above line should match every request coming to your domain with 'wordress' at the start and redirect it to /w/. The '301' tells the browser (and search engines) that the page(s) have moved permenantly. The $1 exists to redirect anything after /wordpress/ and append it to the redirected URL. So if I visit http://example.com/wordpress/this-post/ I would get redirected to http://example.com/w/this-post.


Add this rule to your .htaccess file:

RewriteEngine on

RewriteRule wordpress(.*)$ /w$1

If doesnt work.. let me know... :)

0

精彩评论

暂无评论...
验证码 换一张
取 消