Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New to the CF scene
    Join Date
    Jun 2011
    Location
    Italy
    Posts
    4
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Remove part of the urls

    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?

  • #2
    New Coder
    Join Date
    Jul 2011
    Posts
    67
    Thanks
    0
    Thanked 13 Times in 13 Posts
    Put a rule before the current one redirecting anything that begins with it.

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

  • Users who have thanked Cags for this post:

    reservoirdog198 (08-15-2011)

  • #3
    New to the CF scene
    Join Date
    Jun 2011
    Location
    Italy
    Posts
    4
    Thanks
    1
    Thanked 0 Times in 0 Posts
    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?

  • #4
    New Coder
    Join Date
    Jul 2011
    Posts
    67
    Thanks
    0
    Thanked 13 Times in 13 Posts
    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.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •