开发者

htaccess redirect to subfolder with same path attached?

How can I go about redirecting my old URLs which would have been: http:// blah.com/some/post/name

to the new URLs which would be: ht开发者_开发知识库tp:// blah.com/new/some/post/name

Is this even possible?

I don't want to simply redirect any requests for the blah.com domain to blah.com/new

I want to make sure the subpath is still attached to the redirect


it should be possible.

Try to put this in your .htaccess file:

<IfModule mod_rewrite.c>
Options +FollowSymlinks
RewriteEngine on
RewriteCond %{REQUEST_URI} ^/some\/?
RewriteRule (.*) /new/$1 [R=301]
</IfModule>

Try it out and let me know - I haven't had time to test it very thoroughly.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜