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
-
Index Problem
Hi guys I have a critical problem with google crawler. Its my website : https://1stquest.com I can't create sitemap with online site map creator tools such as XML-simemap.org Fetch as google tools usually mark as partial MOZ crawler test found both HTTP and HTTPS version on site! and google cant index several pages on site. Is problem regards to "unsafe URL"? or something else?
Intermediate & Advanced SEO | | Okesta0 -
Google Frequently Indexing - Good or Bad?
Hi, My website is only 4 months old and receives about 40 to 50 organic visits every day. It currently has about 100 pages out of which only 3-4 rank in the top 10 for the target KWs. I usually try to publish, at least 1 article a day but sometimes certain articles are more than 2000 words long with a few of infographics and hence takes way more time (maybe even 3 days to publish one) Only over the last week, I am observing that every time i am publishing a page (usually daily) google is indexing them the same day. This I have heard happens for moderately big sites but my site is really small at this stage. Note: For the first 80 pages, I used to "fetch as googlebot" in webmasters as otherwise my site would be crawled once in 2 weeks but over the last 3-4 weeks, i rely on googles scheduled visits. Is this a good or bad sign? I would like to assume its good because of my engagement. Though for only organic visits, my Gogle Analytics bounce rate is 65% in analytics out of the remaining 35%, the avg time on site >7 mins. That means if someone sticks to my site, they consume a lot of my content. Also, since analytics' bounce rate is not same as the search bounce (back button) I would like to consider that the bounce is actually lesser than that.
Intermediate & Advanced SEO | | dwautism0 -
Weird indexing problem - Can it be solved?
Hi Been building and optimising sites for 15 years and this is one of the hardest problems I ever came across. So any help would be very much appreciated. Here we go: For some mysterious reason this URL http://weekend.visitsweden.com/no/ has been indexed as http://weekend.visitsweden.com even if we tried all we can to correct it. The problem is that since the latter points to the first URL with a 301 it refuses to get any page rank. Also it does not get visible in Google at all. Just a recap of what we have tried so far: Add site to webmaster tools Add proper sitemap.xml Add 301 redirect to the correct URL An easy way to locate the problem is to search for the main content of the site. As you can see it returns the wrong URL and the correct URL does not even get listed. Again, any help is very much appreciated. Kind regards Fredrik
Intermediate & Advanced SEO | | Resultify0 -
Removing poor domain authority backlinks worth it?
Hey Moz, I am working with a client on more advanced SEO tactics. This client has a reputable domain authority of 67 and 50,000+ backlinks. We're wanting to continue SEO efforts and stay on top of any bad backlinks that may arise. Would it be worth asking websites (below 20 domain authority) to remove our links? Then, use the disavow tool if they do not respond. Is this a common SEO practice for continued advanced efforts? Also, what would your domain authority benchmark be? I used 20 just as an example. Thanks so much for your help. Cole
Intermediate & Advanced SEO | | ColeLusby1 -
Un Natural Links Removal Strategy
Hi All, I want to discuss one of my strategy that i applied on my website to dilute the value of TOXIC links those are coming on my website. Issue: Poor, Spam quality links were created for the home page and some inner pages. Google considered those links Unnatural and took manual action All rankings were disappeared Strategy Deleted all landing pages those are over linked from spam websites. Created new landing pages with some modifications and new content. Because home page(index.html) was also penalized by Google, i made the changes in index.html and put no follow no index tag so that bad links value couldn't pass from index.html to other inner pages (Newly created pages and pages those were not over optimized). Created new index.php page. Give option to the user to the Enter the Website from Index.html (Default Home Page) to index.php. Blocked all bad URLs (Un Natural Links) through .htaccess file. When user or Google bot will come through those blocked URLs (Un Natural Links), server responses 403 (Access Denied). The domain for which i did above experiment is http://www.thebaildepot.com/index.php Now, i have doubts on below points: Blocking unnatural links (403, access denied) from .htaccess file will really work? No follow no index to default page and than give option to the user to navigate to newly create index.php I did this experiment around 10 days before still rankings are not coming in Google top 100.
Intermediate & Advanced SEO | | RuchiPardal0 -
Getting Pages Requiring Login Indexed
Somehow certain newspapers' webpages show up in the index but require login. My client has a whole section of the site that requires a login (registration is free), and we'd love to get that content indexed. The developer offered to remove the login requirement for specific user agents (eg Googlebot, et al.). I am afraid this might get us penalized. Any insight?
Intermediate & Advanced SEO | | TheEspresseo0 -
How to remove hundreds of duplicate pages
Hi - while i was checking duplicate links, am finding hundreds of duplicates pages :- having undefined after domain name and before sub page url having /%5C%22/ after domain name and before the sub page url Due to Pagination limits Its a joomla site - http://www.mycarhelpline.com Any suggestions - shall we use:- 301 redirect leave these as standdstill and what to do of pagination pages (shall we create a separate title tag n meta description of every pagination page as unique one) thanks
Intermediate & Advanced SEO | | Modi0