basically I want to establish within each php file how the request came, can I examine the requested url for whether it's a new version, or old version. if it's an old version, then output this code <?php header("HTTP/1.1 301 Moved Permanently"); header("Location: http://www.yourdomain.com/newpath"); exit(); ?> If I use this code as it stands i get Thank You Jamie
I have tried and get the same resuts I wonder if I am gettng this all wrong, I had a url www.mysite/germanpointersinengland.php and used a rewrite on that page to make the url www.mysite/german/pointers/in/england/ so now both URLs find the same page, the site with its old URL's is well indexed in Google, Yahoo etc. I guess that a redirect might be trying to point to itself, hence not working. I am getting confused with it all. Any help would b great. Jamie
There's no reason to use exit(); you can get rid of that. using Header("Location:"); is enough. But yes, it should have something to do with .htaccess if you're getting a URL excess limit error.
The old urls are indexed, as well as people deep linking to my pages, I need to keep all those links! If I have 2URLs pointing to the same pagewont dear old google penalize the site for dupe content Jamie edit - I just re-read my first post - i was thinking that if a post re-write URL was accessing the page the I could show the new url some how (probably aload of bollocks)
I am using like 1mb .htaccess for this thing Jim se's still don't forget my old page urls. I am trying to find a solution for that in these days. But many se's don't like redirections so i suggest you use .htaccess too.
An examples of how to do redirection via .htaccess. RedirectMatch permanent ^/germanpointersinengland.php$ http://www.mysite/german/pointers/in/england/ Hope that this helps you.
I will try that now If I type in the old url in the address bar I assume it will not change ie http://www.mysite/germanpointersinengland.php$ would show the page but would not change to http://www.mysite/german/pointers/in/england/ is that correct?
I get again with that method, here is the script re that rewrite RewriteRule ^cornwall$ /AccommodationCornwall.php [L] RedirectMatch permanent ^/AccommodationCornwall.php$ http://www.test.visitdevonandcornwall.co.uk/cornwall
RewriteRule ^cornwall$ /AccommodationCornwall.php [L] RedirectMatch permanent ^/AccommodationCornwall.php$ http://www.test.visitdevonandcornwall.co.uk/cornwall is what I have and I get
If you do a mod rewrite then you can't contunue to use the same script you were using for the old page. If you try to do this then you will get an infinite loop of one page redirecting to another. The only solution is to use a different php script for the new page and then redirect the old page to the new friendly url. eg oldpage.php3 redirects to /file/newpage/55 which uses mod rewrite to call the script newpage.php3