This is a discussion on 301 redirects displaying variables when they're not supposed to within the Search Engine Optimisation forums, part of the Online Marketing category; Hello all, some-time lurker, first-time poster here. I apologise for the horrible substitution of : and . in urls with ...
| |||||||
| Register | Forum Rules | FAQ | Donate | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| Hello all, some-time lurker, first-time poster here. I apologise for the horrible substitution of : and . in urls with ; and - but you know how it is, ten posts first. I'm upgrading a clients site to make it run smoother and use some dynamic content, and am converting it to php. I'm also aiming to improve his search engine results, most significantly initially with on-page optimisation (all error-free code, copywriting). I'm using a .htaccess rewrite to pass page variables from urls, and that's working grand. www-site-com/rhino-html , instead of accessing a -html file, tells the site to display a page using the information for the 'rhino' entry in the table where the stuff in each page is listed. Google toolbar shows the old Pagerank value for the page, which was associated with the old html file. All internal links on the site have the -html extension too. However I want to have clean urls of the type www-site-com/rhino for most of the pages, and not have a file extension. I've already had this working, but of course want to build on the old ranks for each page, not start from scratch. My aim is to use some kind of 301 redirect, but unfortunately, this is where it gets confusing (for me). When I go to www-site-com/rhino , I see the right content. When I go to www-site-com/rhino-html , I see the right content. I only want one page searched, and want it clean, so I add to htaccess: Redirect 301 /rhino-html http;//www-site-com/rhino Then when I go to rhino-html, I see the right content, but the address in the address bar is: http;//www-site-com/rhino?variable=rhino-html I think this is bad for searches, etc I have one rewrite rule: RewriteRule ([^/]+) index.php?variable=$1 [QSA] This appears after the redirects. Any suggestions? If I get this fixed, I'll add how I did it, in case anyone else has this problem, but I think they probably won't, as I'm quite new to 301's. |
| ||||
| Well, in the end I made a php statement of this nature: Code: if(preg_match("/.html/",variable)){
Header( "HTTP/1.1 301 Moved Permanently" );
Header( "Location: http;//www-site-com/".str_replace(".html","",variable)."" );
}
Last edited by hydrosylator; 10-07-2009 at 07:37 PM.. Reason: trying to make variables display right |
| Tags |
| 301, displaying, redirects, supposed, variables |
| Thread Tools | |
| Display Modes | |
| |
| ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| PHP form to capture variables and then email? | ButtermilkJack | Coding Help | 3 | 18-07-2008 12:59 AM |
| Not really too sure what I'm supposed to do | musicformedia | Server / Technical Administration Tips and Queries | 3 | 29-05-2008 11:47 PM |
| sending Ajax POST variables | Ciarán Mc Cann | Coding Help | 22 | 05-10-2007 08:52 PM |
| Geotargetted Redirects? | blacknight | Coding Help | 18 | 06-08-2006 08:39 PM |
| ||||
| | ![]() | |||
| | ![]() | |||