开发者

anything.com/xxx to redirect to anything.com using serveralias

开发者 https://www.devze.com 2023-02-20 14:33 出处:网络
I want to redirect An开发者_Go百科ything.com/xxx to Anything.com using serverAlias. Thanks JeanIf you mean redirecting the literal path /xxx to /, you can just use a RedirectPermanent directive.Note:

I want to redirect An开发者_Go百科ything.com/xxx to Anything.com using serverAlias.

Thanks Jean


If you mean redirecting the literal path /xxx to /, you can just use a RedirectPermanent directive. Note: this will also redirect urls like /xxx2 to /2 and /xxx/yyy to //yyy.

RedirectPermanent /xxx http://Anything.com

If you are looking for something fancier like only redirecting the literal /xxx or even redirecting any path under Anything.com to http://Anything.com/ you will need mod_rewrite. This redirects only /xxx to /:

RewriteEngine On
RewriteRule ^/xxx$ /

If instead, you really want to squash all paths under the site to /, try this:

RewriteEngine On
RewriteRule ^/..*$ /

This makes any URL containing at least one character after the / to map to /. Full docs are here: http://httpd.apache.org/docs/2.0/mod/mod_rewrite.html

0

精彩评论

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