开发者

mod_rewrite for redirecting a directory to a top level domain

开发者 https://www.devze.com 2023-03-06 01:50 出处:网络
I\'m brand new to writing mod_rewrites and could use some help.I have a directory like this in my site:

I'm brand new to writing mod_rewrites and could use some help. I have a directory like this in my site:

http://domain.com/de

This goes to our German site. Domain.de points to the /de folder. So how do I write a mod_rewrite rule that will redirect like this:

domain.com/de/contact-us => domain.de/contact-us
domain.com/de/markets => domain.de/markets
domain.com/de/materials => domain.de/materials

Etc.

If you could provide the full mod_rewrite that would be great. 开发者_运维技巧This noob would greatly appreciate it. Thanks.


This will redirect any request to the de folder to your *.de domain.

RewriteEngine On
RewriteCond %{HTTP_HOST} ^domain.com$ [NC]
RewriteRule ^/de/(.*)$ http://domain.de/$1 [L]
0

精彩评论

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