How do i redirect www.domain.com/ to www.domain.com/index.php
-
I keep getting in my analytics www.domain.com/ and www.domain.com/index.php how do i make it consistently redirect to one version and not to both.
I know about htaccess redirect and am already using this so am puzzle to which is the best one to use.
below is the example .htaccess file im using.
Options +FollowSymlinks
RewriteEngine on
rewritecond %{http_host} ^domain.co.uk [nc]
rewriterule ^(.*)$ http://www.domain.co.uk/index.php$1 [r=301,nc]which is better for SEO should i forward to www.domain.com/ or www.domain.com/index.php
-
I'd actually do it the other way - redirect "index.php" to the root ("/") version - Google seems to prefer that and many of your inbound links will be to the root domain (people naturally default to it). Make sure your internal links point to that ("/") as well. See this post that expands on that and gives some .htaccess examples:
http://www.searchmasters.co.nz/articles/78/redirecting-indexphp-to-root-using-htaccess/
You can add the canonical tag to help sweep up the problem, but I think it's best to have a solid 301-redirect in place here, especially if both versions are showing up in analytics.
-
use the rel="canonical" tag I believe http://support.google.com/webmasters/bin/answer.py?hl=en&answer=139394
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
-
Does redirecting a duplicate page NOT in Google‘s index pass link juice? (External links not showing in search console)
Hello! We have a powerful page that has been selected by Google as a duplicate page of another page on the site. The duplicate is not indexed by Google, and the referring domains pointing towards that page aren’t recognized by Google in the search console (when looking at the links report). My question is - if we 301 redirect the duplicate page towards the one that Google has selected as canonical, will the link juice be passed to the new page? Thanks!
Intermediate & Advanced SEO | | Lewald10 -
Domains and Domain Authority
Looking for some advice 🙂 I have a domain that has been registered since 1999 and currently hosts my website - the problem is that my business has moved in a different direction and my URL is no longer associated with my main product offering. For example in the past I was xyzgarden.com however now something like xyzhomedecor.com is much more appropriate. How should I handle this so that I am not at a disadvantage for SEO. thanks!
Intermediate & Advanced SEO | | MainstreamMktg0 -
Not appearing when www.domainname.com.au is searched
We are working on an SEO campaign that has an issue, of which we are unsure of the cause. When the domain is searched for in Google as domainname.com.au. The search results show the website just fine. See here for the display of this. http://imgur.com/a/Vcbqs However, when the domain is searched for in Google as www.domainname.com.au. The search results do not display our website. See here to see this issue. http://imgur.com/a/jX692 We are unsure why our website does not appear in Google's listings when the www. is added in search. If anyone can help us here to explain and help us resolve this, that would be much appreciated.
Intermediate & Advanced SEO | | Gavo0 -
Purchasing an existing domain + redirecting to company's domain
Let's pretend that competitor.com ranks well for certain search terms and generates some traffic from organic search. If a company were to acquire the competitor (or their domain), what's the smartest way to redirect that SEO value to the acquiring company's website? Does a 301 redirect work between different root domains? Even if it does work, is that the smartest approach? Thanks for your help!
Intermediate & Advanced SEO | | Raleigh0 -
Visibility for https://goo.gl/gJH7eh
Hi Mozzers, I am wondering if anyone can help me with the following. At the start of May this year we really lost visibility for the homepage of this site https://goo.gl/gJH7eh. This was particularly noticeable by tracking rankings for the term 'oak furniture'. We previously ranked on page 1 for the term 'oak furniture', but since May the homepage has struggled to make the top 100 positions for this term. We're confident that we have done everything within Google's guidelines, but it seems something is really holding the homepage back. The site ranks on page 1 for 'oak furniture' on Bing. The site had previously had a manual penalty for unnatural links (warning received several years ago). These links had a particular emphasis on using the anchor text 'oak furniture'. When we took over the site we did an extensive link clean up and disavow and managed to get the penalty removed at the end of October 2013. Any help would be greatly appreciated. Karen
Intermediate & Advanced SEO | | OFS0 -
Content From One Domain Mysteriously Indexing Under a Different Domain's URL
I've pulled out all the stops and so far this seems like a very technical issue with either Googlebot or our servers. I highly encourage and appreciate responses from those with knowledge of technical SEO/website problems. First some background info: Three websites, http://www.americanmuscle.com, m.americanmuscle.com and http://www.extremeterrain.com as well as all of their sub-domains could potentially be involved. AmericanMuscle sells Mustang parts, Extremeterrain is Jeep-only. Sometime recently, Google has been crawling our americanmuscle.com pages and serving them in the SERPs under an extremeterrain sub-domain, services.extremeterrain.com. You can see for yourself below. Total # of services.extremeterrain.com pages in Google's index: http://screencast.com/t/Dvqhk1TqBtoK When you click the cached version of there supposed pages, you see an americanmuscle page (some desktop, some mobile, none of which exist on extremeterrain.com😞 http://screencast.com/t/FkUgz8NGfFe All of these links give you a 404 when clicked... Many of these pages I've checked have cached multiple times while still being a 404 link--googlebot apparently has re-crawled many times so this is not a one-time fluke. The services. sub-domain serves both AM and XT and lives on the same server as our m.americanmuscle website, but answer to different ports. services.extremeterrain is never used to feed AM data, so why Google is associating the two is a mystery to me. the mobile americanmuscle website is set to only respond on a different port than services. and only responds to AM mobile sub-domains, not googlebot or any other user-agent. Any ideas? As one could imagine this is not an ideal scenario for either website.
Intermediate & Advanced SEO | | andrewv0 -
301 redirect w/ dynamic pages to static
I am trying to redirect old dynamically created pages to a new static one (single page). However, when I implement the redirects, it still uses part of the old dynamic url. For instance... dynamic.php?var=example1 dynamic.php?var=example2 dynamic.php?var=example3 should all redirect to: static.html. However, they are redirecting to: static.html?var=example1 static.html?var=example2 static.html?var=example3 The page is resolving fine, but I don't want google to misinterpret the new static page as numerous page with dup content. I tried this in PHP on the dynamic.php page as follows, but it the problem above persisted: header('HTTP/1.1 301 Moved Permanently');
Intermediate & Advanced SEO | | TheDude
header('Location: http://www.mysite.com/static.html'); I tried doing it in my .htaccess file as follows, but the problem persisted: redirect 301 /info/tool_stimulus.php?var=example1 http://www.mysite.com/static.html
redirect 301 /dynamic.php?var=example2 http://www.mysite.com/static.html Can anyone solve this in PHP or w/ htaccess? Help!!! 🙂0 -
Should 301 Redirects be used only in cross domains or also internally?
In the following video with Cutts: http://youtu.be/r1lVPrYoBkA he explains a bit more about 301 redirects but he only talks about cross sites. What about redirecting internally from a non-existing product in a store to a new similar existing product?
Intermediate & Advanced SEO | | BeytzNet0