Jump to content

301 redirection


imahsan

Recommended Posts

Hello Friends.. how r u all? Ahsan here.. am a newbie to PHP... I am stuck in a problem and I think this is the best platform for discussing issues related to PHP and getting quality solutions..Okay now lets talk about the issue.. I have a website of which i changed the domain name recently.. so now I want all my website visitors, that are requesting a particular page (or the index page) on the old domain, to be redirected (permanently i.e. with 301 header) to the corresponding page on the new domain but with the lower case i.e http://www.olddomain.com/AHSAN/ is redirected to http://www.newdomain.com/ahsan/. In addition to this, I also want to have my old domain in Google webmaster tools i.e. to verify the ownership of my old domain. Now what I did is that I made a .htaccess file as follows :

 

 

 

Options +FollowSymLinks

RewriteEngine on

RewriteRule (.*) http://www.newdomain.com/$1 [R=301,L]

 

 

 

The redirection is working fine but the script is not lowering the case of the URL i.e. http://www.olddomain.com/AHSAN/ is redirected to http://www.newdomain.com/AHSAN/ instead of http://www.newdomain.com/ahsan/ and also Google is not able to verify the ownership of mine for my old domain.. Here I want to mention that I am verifying my website through the "uploading file" method so when google tries to access that file on the old domain it is redirected to the new domain. I hope I am clear with my query.. If I am not, please let me know.. Hope to get the solution soon.

 

Regards

Ahsan

Link to comment
https://forums.phpfreaks.com/topic/186589-301-redirection/
Share on other sites

To my knowledge there is no facility in a .htaccess file to change the case of a URL. You could redirect to a single forward.php file using your .htaccess file and use PHP in that file to redirect again (using header) after converting the URL to lowercase (strtolower). If you have access to the httpd.conf file you can also do it with RewriteMap and the internal tolower function.

Link to comment
https://forums.phpfreaks.com/topic/186589-301-redirection/#findComment-985490
Share on other sites

So can posting things in the correct board..!

 

I proposed three solutions depending on your situation, I'm not wasting my time by coding out examples for each, only for you to eventually use only one of them. You give us enough relevant information and you may end up with a usable example you can copy/paste.

Link to comment
https://forums.phpfreaks.com/topic/186589-301-redirection/#findComment-985533
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.