开发者

Foward directory to domain with parameters stripped for dir only not site wide

I'm permanently forwarding a directory to its own domain, i had a wordpress setup in the directory at one time which google indexed... I've setup the redirect in my .htaccess however permalink structure is appended to the forwarded domain. So im taking everything from /sample forwarding to www.sample.com but im wanting to strip the unused variables from the url such as www.sample.com/?p=6, etc... However i need this done only for files in the /sample directory as i still have wordpress installs that need to remain 开发者_如何学JAVAintact. Also how can i not have a double forward slash after the redirect. I have:

Redirect permanent /sample http://www.sample.com

But it outputs http://www.sample.com//


Try this instead:

Redirect 301 /sample/ http://www.sample.com/?

The ? should strip query string (?p=6 etc)

The same but using mod_rewrite:

RewriteRule ^(sample(/|/.*)?)$ http://www.sample.com/$1? [NC,R=301,L]
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜