...

View Full Version : Remove part of the urls



reservoirdog198
08-15-2011, 09:19 PM
Hi all,
I working on a website that is built to work in more languages. All the the urls are written like:
www,mydomain,com/lang/my_page.html

The urls are re-written using:
RewriteRule ^([^/.]+)/([^/.]+).html$ /index.php?language=$1&page=$2

The problem is that the website is currently in one language (italian).
For the moment, I would like to remove the language identifier (it) without changing all the links of the website.

I'd like the page above:
www,mydomain,com/it/my_page.html

to redirect to:
www,mydomain,com/my_page.html

Then i would modify the url re-write in order to be:
RewriteRule ^([^/.]+).html$ /index.php?language=it&page=$1

But how can I redirect to the same page removing the /it/ parameter?

Cags
08-15-2011, 11:05 PM
Put a rule before the current one redirecting anything that begins with it.


RewriteRule ^it/(.*)$ /$1 [R=301,L]

reservoirdog198
08-15-2011, 11:49 PM
thanks for the reply, it's working.
i'm just wondering now, does that make any difference to search engines?
would they index www.domain.it/it/page.html or www.domain.it/page.html?

Cags
08-16-2011, 08:20 AM
Good question, in all honesty I'm not sure. In theory Google would index the links it finds for your site, which means if the links have it in them then they would be indexed, BUT I suspect Google is clever enough to follow the 301 redirect before indexing. I guess what I'm saying is, I'm not 100% certain but it should be fine (after all if you can't redirect GoogleBot, how would new URI schemas ever get implemented?). Personally I would change the links on my site to remove the 'it' part until it's required in future, but depending on how your site is built that might not be very easy.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum