Removing index.php
-
I have question for the community and whether or not this is a good or bad idea.
I currently have a Joomla site that displays www.domain.com/index.php in all the URLs with the exception of the home page. I have read that it's better to not have index.php showing in the URL at all. Does it really matter if I have index.php in my URL? I've read that it is a bad practice.
I am thinking about installing the sh404SEF component on my site and removing the index.php. However, I rank pretty high for the keywords I want in Google, Bing and Yahoo. All of the URLs that show up in the searches have index.php as part of the URL.
Has anyone ever used sh404SEF to remove the index.php and how did you overcome not loosing your search engine links? I don't want an existing search showing www.domain.com/index.php/sales and it not linking to the correct page which would now be www.domain.com/sales. I guess I could insert the proper redirects in the htaccess file. But I was hoping to avoid having every page of my site in the htaccess file for redirecting.
Any help or advice appreciated.
-
Add this to your htaccess file (remove the .txt extension from the file in order to use it)
Remove index.php or index.htm/html from URL requests
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /(([^/]+/)*)index.(php|html?)\ HTTP/
RewriteCond %{REQUEST_URI} !^/administrator
RewriteRule ^([^/]+/)*index.(html?|php)$ http://your_site_URL/$1 [R=301,L]Obviously change the your_site_url to the your domain in http://your_site_URL/$1
Also remove the # before RewriteEngine On to make these changes work.
-
Devanur/Jane,
Thank you for the info.
Dan
-
As Devanur says, this will achieve your goal. It's worth reiterating that there is nothing inherently wrong with /index.php URLs as long as you cannot access the same content without /index.php. For instance, if www.site.com/page1/index.php exists as well as www.site.com/page1/, then this is duplicate content and should be fixed. I imagine this is your current situation because this is most common when /index.php is being added to URLs.
However, if only one version of every page loads and that version has the /index.php extension, this is not automatically bad. It's preferable for the extension not to be there for the sake of URL tidiness and because this does move the content one folder-level away from the root (not a huge issue, but probably best avoided) however.
If you go through 301 redirects to shift the old URLs to the new ones without /index.php, your rankings should not suffer. There might be a little bit of ranking fluctuation as Google indexes the new URLs and acknowledges the redirects, but nothing permanent. It's worth noting that this is not an absolute rule, however, and that there is always a risk of lowered rankings or rankings not returning to what they were before after a 301 redirect though.
Cheers,
Jane
-
Hi, any plugin like sh404SEF will work and accomplish your goal without hurting your rankings as long as it redirects, the index.php URLs to their corresponding without index.php URLs via 301. By the way, you don't need to list all your URLs in .htaccess file to implement this. You can go with pattern match redirection.
Here you go for more:
http://www.askapache.com/htaccess/301-redirect-with-mod_rewrite-or-redirectmatch.html
and
http://www.searchenginepeople.com/blog/htaccess-redirect-rewrite-rules.html
By the way, having index.php in URLs does not affect your SEO efforts directly but by stripping index.php from all the URLs will make them look pretty, clean and a bit user friendly.
Hope it helps. Good Luck to you.
Best regards,
Devanur Rafi
<colgroup><col width="182"></colgroup>
| |
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
-
Beta Site Removal best practices
Hi everyone.
Intermediate & Advanced SEO | | bgvsiteadmin
We are doing a CMS migration and site redesign with some structural changes. Our temporarily Beta site (one of the staging environments and the only one that is not behind firewall) started appearing in search. Site got indexed before we added robots.txt due to dev error (at that time all pages were index,follow due to nature of beta site, it is a final stage that mirrors live site) As an remedy, we implemented robots.txt for beta version as : User-Agent: *
Disallow: / Removed beta form search for 90 days. Also, changed all pages to no index/no follow . Those blockers will be changed once code for beta get pushed into production. However, We already have all links redirected (301) from old site to new one. this will go in effect once migration starts (we will go live with completely redesigned site that is now in beta, in few days). After that, beta will be deleted completely and become 404 or 410. So the question is, should we delete beta site and simple make 404/410 without any redirects (site as is existed for only few days ). What is best thing to do, we don't want to hurt our SEO equity. Please let me know if you need more clarification. Thank you!0 -
Why is wrong domain being indexed?
We have 2 domains: revolve.com and fwrd.com (unrelated to each other, but hosted on the same server). If you do a site search for revolve.com but enter a designer brand that is only carried on FWRD (not on Revolve), the domain "revolve.com" pops up in the SERP, which is redirected to FWRD.com. Ex. https://www.google.com/webhp?sourceid=chrome-instant&ion=1&espv=2&ie=UTF-8#q=site%3Awww.revolve.com isabel marant Why is Google indexing the revolve.com pages, which don't actually exist? Thanks.
Intermediate & Advanced SEO | | ggpaul5620 -
[wtf] Mysterious Homepage De-Indexing
Our homepage, as well as several similar landing pages, have vanished from the index. Could you guys review the below pages to make sure I'm not missing something really obvious?! URLs: http://www.grammarly.com http://www.grammarly.com/plagiarism-checker It's been four days, so it's not just a temporary fluctuation The pages don't have a "noindex" tag on them and aren't being excluded in our robots.txt There's no notification about a penalty in WMT Clues: WMT is returning an "HTTP 200 OK" for Fetch, is showing a redirect to grammarly.com/1 (alternate version of homepage, contains rel=canonical back to homepage) for Fetch+Render. Could this be causing a circular redirect? Some pages on our domain are ranking fine, e.g. https://www.google.com/search?q=grammarly+answers A month ago, we redesigned the pages in question. The new versions are pretty script-heavy, as you can see. We don't have a sitemap set up yet. Any ideas? Thanks in advance, friends!
Intermediate & Advanced SEO | | ipancake0 -
Getting a Facebox Item De-Indexed
Hello all, Select pages on a website I manage utilizes Facebox lightbox elements for additional information. These Faceboxes have been indexed as their own pages by Google. Unfortunately, when they were created, there is no call to action or navigation elements or anything. So I would prefer that Google not index them since it is a pretty horrible user experience if you navigate to one of these Faceboxes directly. I have tossed up no-index tags on each about three weeks ago, but they are still being indexed at present. Is there any tips or tricks that anyone has to handle this scenario or any ideas that I am not thinking of outside of just no-indexing them? Thanks in advance!
Intermediate & Advanced SEO | | ClayPotCreative0 -
Google indexing issue?
Hey Guys, After a lot of hard work, we finally fixed the problem on our site that didn't seem to show Meta Descriptions in Google, as well as "noindex, follow" on tags. Here's my question: In our source code, I am seeing both Meta descriptions on pages, and posts, as well as noindex, follow on tag pages, however, they are still showing the old results and tags are also still showing in Google search after about 36 hours. Is it just a matter of time now or is something else wrong?
Intermediate & Advanced SEO | | ttb0 -
Ranking with other pages not index
The site ranks on page 4-5 with other page like privacy, about us, term pages. I encounter this problem allot in the last weeks; this usually occurs after the page sits 1-2 months on page 1 for the terms. I'm thinking of to much use the same anchor as a primary issue. The sites in questions are 1-5 pages microniche sites. Any suggestions is appreciated. Thank You
Intermediate & Advanced SEO | | m3fan0 -
Remove www. in google webmaster
Hi. My baseball blog (mopupduty.com) shows up as www.mopupduty.com in Google Webmaster tools. This is an issue for me, as my Wordpress plug-in sitemap will only show up on http://mopupduty.com/sitemap.xml , not the www. version Is there any way in changing the www. in webmaster tools without deleting my existing index. The website currently has sitelinks in search results, and I'm not too keen in giving them up via deletion. Thanks
Intermediate & Advanced SEO | | mkoster0 -
Is there a FastTrack to re-index? a site?
Hello... i just started with a new client this week, before working with us his last domain-hosting-webdev provider cancel their account and took off the entire site and left them with a nice "under construction page" (NOT) and added the noindex, nofollow tags. 4 weeks after that, we come into the scene and of course our client it's expecting us to reinsert at least for branded terms the site, and he wants it done on a matter of hours... I tried my best to explain that it's not possible and we are doing everything we can't.... now i ask you guys.. I already created de GWT account, Created a well structured Sitemap and submitted it to google and bing, did the onpage optimizitation at least the basics... there is a way to speed up the process? kind of like "hey you! google bot, forget about the noindex nonsense a come crawl again?" Any help would be great Daniel
Intermediate & Advanced SEO | | daniel.alvarez0