On Page 301 redirect for html pages
-
For php pages youve got
Header( "HTTP/1.1 301 Moved Permanently" );
Header( "Location: http://www.example.com" );
?>Is there anything for html pages? Other then
Or is placing this code redirect 301 /old/old.htm http://www.you.com/new.php in the .htaccess the only way to properly 301 redirect html pages?
Thanks!
-
Yeah - htaccess is the way to go for rewrite rules. Check out http://www.seomoz.org/learn-seo/redirection for more depth/detail, too.
-
I am suprised no one is recommending using the httpd.conf file. It functions the same as the.htaccess file except it is much more efficient because it is loaded into the servers memory which means the file is opened & read once. With an .htaccess file the server reads the file on every request.
Also, if PHP is enabled on the server you can use php code in html pages. There is a php or server setting where you can say read html pages as php.
-
I have a lot (100+) of 301 redirects to do for .html pages, is the .htaccess the only way to go?
Thanks
-
Just make sure not to use this for a whole ton of 301 redirects. If it is a big enough redirect project using PHP might be the way to go.
-
My vote gose to the htaccess any time all the time.
It's global, you can add all the rewrite rules within the same global file.
Is just my opinion.
Got a burning SEO question?
Subscribe to Moz Pro to gain full access to Q&A, answer questions, and ask your own.
Browse Questions
Explore more categories
-
Moz Tools
Chat with the community about the Moz tools.
-
SEO Tactics
Discuss the SEO process with fellow marketers
-
Community
Discuss industry events, jobs, and news!
-
Digital Marketing
Chat about tactics outside of SEO
-
Research & Trends
Dive into research and trends in the search industry.
-
Support
Connect on product support and feature requests.
Related Questions
-
Advice on whether we 301 redirect a page or update existing page?
Hi guys, any advice would be really appreciated. We have an existing page that ranks well for 'red widgets'. The page isn't monetised right now, but we're bringing in a new product onto our site that we optimised for 'blue widgets'. Unfortunately, not enough research was done for this page and we've now realised that consumers actually search for 'red widgets' when looking for the product we're creating as 'blue widgets'. The problem with this is that the 'red widgets' page is in a completely different category of our site than what it needs to be (it needs to be with 'blue widgets'). So, my question is; Should we do a 301 redirect from our 'red-widgets' page to our 'blue-widgets' page which we want to update and optimise the content on there for 'red-widgets'. Or, should we update the existing red-widgets page to have the right products and content on there, even thought it is in the wrong place of our site and users could get confused as to why they are there. If we do a 301 redirect to our new page, will we lose our rankings and have to start again, or is there a better way around this? Thanks! Dave
Technical SEO | | davo230 -
My Alexa ranking dropped after a 301 redirect is that bad?
I had all of my non www pages redirect to the www versions. My alexa ranking dropped and keeps dropping after I did this. I'm guessing its because its tracking the non www version. Does anyone know if this is correct and should I worry?
Technical SEO | | CandleCam0 -
Does 301 redirect of old filenames still work?
I have gone through several revisions of my site. We used to have only static pages in HTML. I had search-engine-optimization.html changed to seo-philippines.html changed to /seo-philippines/ I 301 redirected all of them whenever I change the filenames. This is in the course of 6 years worth of link building and I'm wondering if this has an effect because our rankings go down everytime we do this.
Technical SEO | | optimind0 -
Static site to wordpress - avoiding 301 redirects
Moving our static website to wordpress, pages currently end in the .htm extension and for reasons of me having to do all the moving myself and wanting to preserve link equity is there any way I can run the pages with a .htm extension in Wordpress? Tried using a plug-in by Daddy Design but it seems a bit hit and miss at times. I basically need to keep the url's the same as I will not be able to get the vast majority of my links altered to the new pages, plus I am doing this by myself!
Technical SEO | | Jon-C0 -
Quick Seo question regarding 301 redirect
Hi everyone and thank you for showing interested in my problem and for helping me out with this easy thing i have going on Here is how it puts out : I have 2 websites, same niche, mostly same keywords. Site #1 holding strong on google #2 ranking for months now. Site #2 was holding strong in google top 10 rankings until 2 weeks ago when it got sandboxed for some reason I want to use a 301 permanent redirect from Site #2 to Site #1 to pass all the link juice onto Site #1 and hopefully beat the #1 spot The question: Will this affect Site #1 is anyway, considering Site #2 is in somehow sandbox ( i assume that, since he dropped more then 70 positions over night ) Is thins a good think to do or i risk damaging Site #1 by doing this ? Thanks allot in advance. Best regards,
Technical SEO | | caw_ro
Trinca Alexandru0 -
My home page 301 redirects - is this an SEO problem
When ever a browser calls my site canineconcepts.co.uk, it is automatically 301 redirected to canineconcepts.co.uk/en I am not sure if I should be concerned about this from an SEO perspective or not. Any thoughts?
Technical SEO | | CanineConcepts0 -
301 redirect .htaccess problem
Can anyone explain to me why this doesn't work? Redirect 301 /category/diamond-pendants/nstart/1/start/(.*) http://www.povada.com/category/pendants/nstart/1/start/$1 Im trying to replace everything after /start/ and insert it into the new url. Thanks in advance.
Technical SEO | | 13375auc30 -
Minisites - 301 Redirect or Links to Main site
Not sure whether this is considered black hat or not but I know it is done and I would like to know which is the most effectrive method. If you were to acquire multiple sites in the same niche to your main site (either by buying existing sites or perhaps registering expired domains) which already had strong aged backlinks, is it better to either: a) 301 the new domain to the main site (or a subpage perhaps) b) create 'minisites' on the new domains (trying to mirror the URL structure of the previous incarnation if possible to scoop up and remaining inbound backlink juice, on seperate IPs to the main site as well) and then place several links to the main site & subpages. Would the decay of link juice through 301's mean you lose benefit that way or is it the same as a normal link? Would the 301 method mean any IBL's into URL's other than the homepage be lost? The homepage of the minisite will likely have 4 or 5 internal links so will this dilure the effect of the links to the main site? Thanks in advance!
Technical SEO | | OzDave0