开发者

two domains , one .htaccess, troubles properly redirecting old url to the homepage

开发者 https://www.devze.com 2023-02-28 05:52 出处:网络
Ok I got this task to do: There are 2 old URL\'s mysite.se/thepath and mysite.eu/thepath indexed on google, but that path doesn\'t exist anymore and I have to redirect the links to the homepage inste

Ok I got this task to do:

There are 2 old URL's mysite.se/thepath and mysite.eu/thepath indexed on google, but that path doesn't exist anymore and I have to redirect the links to the homepage instead : mysite.se for se domain and mysite.eu for eu domain.

As you can see the site is (joomla) 2 language based and each language is linked to specific domain. And there is only one .htaccess at the root of the site.

The one thing that gets me close is placing:

Redirect 301 /thepath http://www.mysite.se

but now even the mysite.eu/thepath redirects to mysite.se but it should go to mysite.eu instead.

I've read many of the posts here, but not one of the answers was close to my issue.

Thank you for any ins开发者_开发知识库ight on this.


I think just 1 rules like this would be good enough for both the sites redirects:

RewriteRule ^thepath/?$ /? [R=301,L,NC]


EDIT:
How about this?

# If your concerned about direct access to a particular page without the sub-dir # you will want to add something like this
RewriteCond %{REQUEST_URI} ^/thepath
RewriteRule (.*) /$1 [R=301,L]
This was taken from here

Here is more on mod_rewrite.

0

精彩评论

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