How to properly abandon mod rewrite?
-
Hi,
We've done mod-rewrite to our .php files to show .htm files several years ago for SEO purposes.
My question is, doing this has become a hassle for adding new pages, etc. and I'd like to make a clean break with the .htm and move to their real file names and or directories (e.g. company.htm --> /company/ ).
What kind of ranking penalty am I looking at if we switch? We're a small company with billion dollar competitors so a rank loss would be fairly devastating.
I assume I'd need to do 301 redirects for all of the old file names (obviously yes for the change from page to directories) but for each individual page?
Thanks,
Matt
-
Maybe I am missing something, but wouldn't a rewrite that removes all the .php instances solve this problem site-wide? Or are you doing it file by file and leaving some pages as-is?
Something like this in your .htaccess should do it:
to remove php:
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^(.*)$ $1.phpor to change to htm site-wide:
RewriteEngine on
RewriteBase /
RewriteRule ^([^.]+).htm$ $1.php [L]Another way is to name the files with .htm and use this in htaccess to send htm through your PHP handler:
AddType application/x-httpd-php htm html php
AddHandler application/x-httpd-php .htm .htmlIf you use rewrites like those, you won't be able to also use 301s for the affected URIs as it would probably create a redirect loop.
In a perfect world, you should 301 redirect any page that changes if you stop using the php to htm rewrites. If there are simply too many for this to be practical, you could just redirect the most important pages and leave out any that may not have very many inbound links pointing to it. What I will often do in cases like this is set up the redirects for the important pages, then keep an eye on Google Webmaster Tools. Webmaster Tools will show you the 404 errors and where they found the links. Then you can pick the ones that have a lot of links and 301 those a few at a time. Tedious, but if you do that in your spare time, eventually you will get them all fixed.
If you can implement a "set it and forget it" rewrite so you don't have to add a new rewrite for each file, you won't have to worry about 301 redirecting all those old pages.
Otherwise, there really shouldn't be any major loss of rank from dropping the file types.
All that said, there isn't much of a reason to remove the file type extensions, other than to shorten addresses by a few characters and just look a little cleaner.
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
-
Magento Rewrite Issue
Moz's Crawler has thrown up a bunch of crawl issue for my site.The site is a magento based site and I recently updated the themes so some routes may have have become redundant. Moz has identified 289 pages with Temporary Redirect. I thought magento managed the redirects if I set the "Auto-redirect to Base URL" to Yes(301 Moved permanently). But this is enabled on my store and I still get the errors. The only thing I could think of was to add a Robots.txt and handle the redirection of these links from here. But handling redirection for 289 links is no mean task. I was looking for any ideas that could fix this without me manually doing this .
Technical SEO | | abhishek19860 -
High DA url rewrite to your url...would it increase the Ranking of a website?
Hi, my client use a recruiting management tool called njoyn.com. The url of his site look like: www.example.njoyn.com. Would it increase his ranking if I use this Url above that point to njoyn domain wich has a high DA, and rewrite it to his site www.example.com? If yes how? Thanks
Technical SEO | | bigrat950 -
Setting up addon domains properly (bonus duplicate content issue inside)
A new client of mine is using 1and1 hosting from back in the dark ages. Turns out, her primary domain and her main website (different domain) are exactly the same. She likes to have the domains names of her books, but her intention is to have it redirect to her main site. Unfortunately, 1and1's control panel is light years behind cpanel, so when she set up her new domains it just pointed everything to the same directory. I just want to make sure I don't make this up, so please correct me if I'm wrong about something. I'm assuming this is a major duplicate content deal, so I plan to create a new directory for each add-on domain. Since her main site is an add-on itself, I'll have to move all the files into it's new home directory. Then I'll create an htaccess file for each domain and redirect it to her main site. Right so far? My major concern is with the duplicate content. She's had two sites being exactly the same for years. Will there be any issues leftover after I set everything up properly? Is there anything else I need to do? Thanks for the help guys! I'm fairly new to this community and love the opportunity to learn from the best!
Technical SEO | | Mattymar0 -
Proper structure for site with multiple catagories of same products
Hi, we have products (trophies and awards) that can be catagorized in many ways. Using Award Medals as an example: - Medals by type: 1 1/2", 2", etc. - Medals by sport Baseball, Basketball, Cheer - Medals by Style Color, Gold, Silver, Bronze Right now, we have an Award Medals section off of our home page. The section has a decent page rank, but should be much better (I think). My guess is that we are loosing page range since we have separate sections with the groups above as we want our customers to be able to find the medals easily. Unfortunately, when we setup our site 10 years ago, we organized by type and this is what is hanging off the home page. The other groupings we added more recently. I have attached a snap shot of what the sections look like. We would like customers to find an individual medal when they do a Google search. For example a search for Baseball Medals. In Goggle, they likely would not search for 1 1/2" medals. My question is this: Can we keep the same structure we have today (to enable customer flexibility) but improve page rank and also have the sections like basball medals rank well? I have thought about using canonical tags, but the pages are not the same - in one case it is all baseball medals, in another it is all 1 1/2" medals, etc. Thanks for your help!!
Technical SEO | | trophycentraltrophiesandawards0 -
How to noindex lots of content properly : bluntly or progressively ?
Hello Mozers ! I'm quite in doubt, so I thought why not ask for help ? Here's my problem : I need to better up a website's SEO that consists in a lot (1 million+ pages) of poor content. Basically it's like a catalog, where you select a brand, a product series and then the product, to then fill out a form for a request (sorry for the cryptic description, I can't be more precise). Beside the classic SEO work, a part of what (I think) I need to do is noindex some useless pages and rewrite important ones with great content, but for the noindexing part I'm quite hesitant on the how. There's like 200 000 pages with no visits since a year, so I guess they're pretty much useless junk that would be better off in noindex. But the webmaster is afraid that noindexing that much pages will hurt its long tail (in case of future visits), so he wants to check the SERP position of every one of them, to only eliminate those that are in the top 3 (for these there's no hope of amelioration he thinks). I think it would be wasting a lot of time and resources for nothing, and I'd advise to noindex them regardless of their position. The problem is I lack the experience to be sure of it and how to do it : Is it wise to noindex 200 000 pages bluntly in one time (isn't it a bad signal for google ?) or should we do this progressively in like a few months ? Thanks a lot for your help ! Johann.
Technical SEO | | JohannCR0 -
I have a WordPress site with 30 + categories and about 2k tags. I'd like to bring that number down for each taxonomy. What is the proper practice to do that?
I want to bring my categories down to about 8 or so and the tags... They're just a mess and I'd really like to bring that figure down significantly and setup a standard for usage. My thought was to remove the un-needed tags and categories and setup 301 redirects for the ones that I'm removing. Is that even necessary? Are there tools that can assist with this? What are the "gotchas" I should be aware of? Thanks!
Technical SEO | | digisavvy1 -
Difference between URL Rewrites and 301 Redirects for Rankings
What is the difference between URL rewriting and 301 redirects? Specifically if my home page is rewriting the www. version and the /index.html version rather than 301 redirecting them is this equivalent? Does it still pass the link juice on those alternate variations the same way a 301 redirect will?
Technical SEO | | rcarll0 -
URL Rewrite
Using the .htaccess file how do I rewrite a url from www.exampleurl.com/index.php?page=example to www.exampleurl.com/example removing index.php?page= Any help is muchly appreciated
Technical SEO | | CraigAddyman0