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
This was taken from here
RewriteCond %{REQUEST_URI} ^/thepath
RewriteRule (.*) /$1 [R=301,L]
Here is more on mod_rewrite.
精彩评论