View Full Version : Remove part of the urls

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:

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:

to redirect to:

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?

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]

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?

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.