Forum Moderators: phranque
Recently I've renamed few folders and file names. They already have a good rankings, and hence I wish to use 301 redirect.
I want to redirect the following URL possibilities:
www.domain.com/oldfolder1/
www.domain.com/oldfolder1/index.php
www.domain.com/oldfolder1/index/
to
www.domain.com/newfolder1/
Likewise I also want:
www.domain.com/newfolder1/index.php
www.domain.com/newfolder1/index/
to be redirected to
www.domain.com/newfolder1/
Thank you very much!
Regards
Raj
Please post the code you've tried as a basis for discussion. More information and links to basic resources can be found in our Apache Forum Charter [webmasterworld.com].
There are also many examples of /index to "/" redirects already posted in this forum -- Try a WebmasterWorld site search (See the Search, Library, and Charter links at the top of this page).
Thanks,
Jim
Thank you very much for your reply. I've been using the basic code for the redirect:
Redirect 301 /oldfolder1/index.php http://www.example.com/newfolder1/
The problem is that I have 30 such folders and more than 200 files..
So, let me know if I need to post this topic elsewhere?
Thank you once again.
Regards,
Rajiv
[edited by: jdMorgan at 3:46 pm (utc) on Sep. 18, 2008]
[edit reason] example.com [/edit]
Thank you for the replies and help. For now I've decide to use the basic redirection like:
redirect 301 /old/old.htm to http://www.example.com/new/new.htm
but I am facing a problem. Here is the situation.. I have 2 redirect statements/lines as below in the .htaccess file:
redirect 301 /programA/ http://www.example.com/newprogramA/
redirect 301 /programA/locationA/ http://www.example.com/newprogramA/location-A/
Here, the second URL (the second line)
/programA/locationA is not redirected to /newprogram/location-A
instead it is redirecting to
/newprogram/locationA
which is a 404
The issue is that the sub folder /locationA/ is automatically appended to the landing page/path, instead of picking the URL mentioned.
Hope I am clear.
Thank you !
Regards
Rajiv
[edited by: jdMorgan at 3:47 pm (utc) on Sep. 18, 2008]
[edit reason] example.com [/edit]
The first rule always matches (because it begins with the path you mentioned) so that one is processed. The second one never gets looked at.
Swapping the order, would also (at least partially) solve the problem. Put the most specific stuff first.