.htaccess problem using POST method
-
Hi guys
I'm after some help with trying to achieve the following:
1. Canonicalise to http://www.
2. Remove the index.php from root and subfolders.
I have the .htaccess code below, which seemed to work fine, but the urls use the POST method and this isn't working with the rewrites.
Can anyone please advise as to what I am doing wrong? As you can probably guess .htaccess isn't my strongest SEO discipline!
The code I have is:
http:// to http://www.
RewriteEngine on
RewriteCond %{HTTP_HOST} ^mydomainexample.com
RewriteRule (.*) http://www.mydomainexample.com/$1 [R=301,L]/index.php to /
Options +FollowSymLinks
DirectoryIndex index.phpRewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index.php\ HTTP/
RewriteRule ^index.php$ http://www.mydomainexample.com/ [R=301,L]Subdirectory /index.php to /
RewriteCond %{THE_REQUEST} ^[A-Z]+\ /([^/]+/)index.(php|html|htm?)[#?]?
RewriteRule ^(([^/]+/))index.(php|html|htm?)$ http://www.mydomainexample.com/$1 [R=301,L]Just to add to this I have found this which I think is what I need to restrict it to GET:
RewriteCond %{THE_REQUEST} ^GET.*index\.php [NC]RewriteRule (.*?)index\.php/*(.*) /$1$2 [R=301,L] Thank you in advance for any suggestions as to how I may put this code together..
Trevor
-
Hi Keri
Thanks for the thumbs up
Must be a lot of people out there with the same question; the post on this topic, on my site, gets a lot of visitors.
Thanks again.
-
I gave you a thumbs up! Glad you solved this, and I'm sure it'll help someone in the future. Thanks for posting the answer!
-
Hi guys
Not sure if I can get mozpoints for answering my own question - perhaps someone can thumb it up
Anyway below is the .htaccess code that seems to work for canonicalization and allowing POST:
http:// to http://www.
RewriteEngine on
RewriteCond %{HTTP_HOST} ^mydomainexample.com
RewriteRule (.*) http://www.mydomainexample.com/$1 [R=301,L]REDIRECT /folder/index.php to /folder/
RewriteCond %{THE_REQUEST} ^GET.index.php\ HTTP/
RewriteRule ^(([^/]+/))index.php$ http://www.mydomainexample.com/$1 [R=301,L]Cheers
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
-
Use Internal Search pages as Landing Pages?
Hi all Just a general discussion question about Internal Search pages and using them for SEO. I've been looking to "noindexing / follow" them, but a lot of the Search pages are actually driving significant traffic & revenue. I've over 9,000 search pages indexed that I was going to remove, but after reading this article (https://www.oncrawl.com/technical-seo/seo-internal-search-results/) I was wondering if any of you guys have had success using these pages for SEO, like with using auto-generated content. Or any success stories about using the "noindexing / follow"" too. Thanks!
Technical SEO | | Frankie-BTDublin0 -
Indexing Problem
My URL is: www.memovalley.comWe have submitted our sitemap last month and we are having issues seeing our URLs listed in the search results. Even though our sitemaps contain over 200 URLs, we only currently only have 7 listed (excluding blog.memovalley.com).Can someone help us with this? | |
Technical SEO | | Memovalley
| | | | It looks like Googlebot has timed out, at least once, for one of our URLs. Why is Googlebot timing out? My server is located at Amazon WS, in North Carolina and it is a small instance. Could Google be querying multiple URLs at the same time and jamming my servers? Could it be becauseThanks for your help!0 -
Branding in a post EMD/Panda world?
How do non-business websites think about exact match domain names and branding after EMD and Panda? What is an EMD and what is a "brand" when there's no business or commercial brand involved? And does it impact your SEO outcomes? I have a Thailand travel blog which is a personal crusade of mine. I like Thailand, I love travelling there and I like sharing my experiences and knowledge. I don't have a business name, so when I started the blog I just used the best phrase I could find that was available as a domain name - at the time it was "bangkoktravelthailand.com". Late in 2011 I thought this sounded a bit spammy, so I found a new domain name "traveltipsthailand.com" and 301'd across to that. All went well and traffic grew consistently thanks to good writing and some basic SEO, until in late September 2012 the site got 'whacked' by Google - possibly due to EMD, but I think more likely due to Panda and some accidental poor quality backlinks (I posted a reply on another travel site, pointing back to my site, but it ended up becoming 100s of low value backlinks because of the way that site managed it's "latest comments" widget). Since then I've been trying very hard to rebuild my traffic, but it's a tough gig. I am now averaging better than I was in Sept 2012, but nowhere near where I was on trend to be by now. I have a small social media profile (800 Twitter followers plus Google+, Facebook and Pinterest) and I am slowly building some supporting pages on prominent Web 2.0 sites and seeking out quality guest post opportunities. But I still worry about the domain name. Does Google see it as an EMD? I don't use the domain name words at all in my page titles (I use xxx | Thailand travel blog) and I try not to use it in anchors either (I tend to use "Thailand travel blog" or my own name. But I still have a few old backlinks that say "Travel Tips Thailand" and I use that phrase as my brand when talking about the website. So how should sites like mine think about "brand" and "EMD"? Is it an issue or not? Is my domain name holding my site back? I have others I can use like "1travelthailand.com" and "thailand-travel-blog.com" but I'm just sitting on them, not sure where to go. I also have "asiantraveltips.com" and a long term view of rolling this site up with other blogs I'm slowly developing about China, Cambodia and Vietnam. But again, not sure where to go any more. Anyone care to share their thoughts?
Technical SEO | | Gavin.Atkinson0 -
Business Address SERP problem in Google- What DO?
Hi Guys, I have a business at "30 Auto Center Dr, Irivne, CA" when I search for "30 Auto Center Dr" Google search results will show a map result for 30 auto center dr, Tustin CA. It will show this map result for all surrounding cities and will only show Irivne, if I set my location to irvine. I'm not sure why this is happening. Cities that are closer to Irvine are also showing a map to the address located in Tustin. Since Google is choosing to display this map result, I feel that this is causing me to lose customers. I have already done business listings and local seo to my current address,and was wondering if it would be worth it to change my address (My building has more than one address). Would this even be a good idea? What do you guys think are my options here? attached is the screenshot of the map result I am talking about. 1ywIMVt.png
Technical SEO | | qlkasdjfw0 -
The use of robots.txt
Could someone please confirm that if I do not want to block any pages from my URL, then I do not need a robots.txt file on my site? Thanks
Technical SEO | | ICON_Malta0 -
Your opinion on using the markup from schema.org
I am attending SMXEast and one of the speakers is strongly encouraging to use the markup from schema.org. Does anyone have experience with the markup from schema.org and were you able to track any outcome in the search rankings based on adding this markup?
Technical SEO | | irvingw0 -
E-Commerce Site Crawling Problem
Our website displays all of the products in our website If you attempt to visit a category or page that doesn't exist but conforms to our site url structure. Somehow google crawled these pages and indexed them, and they have TONS of duplicate content that hurt us. How do I deal with this problem?
Technical SEO | | 13375auc30 -
Problem with my site
the site is casino.pt we created the site 7-8 month ago, we started to push it by good and natural links (http://www.opensiteexplorer.org/www.casino.pt/a!links!!filter!all!!source!external!!target!page), links in sites with content rich and most of them related to gambling and sport topics. During the first 3-5 months, the rankings were better and better, after the 6 months, the site lose all its rankings. Aditional details http://www.casino.pt/robots.txt http://www.google.pt/#hl=pt-PT&source=hp&biw=1280&bih=805&q=site:http%3A%2F%2Fwww.casino.pt&aq=f&aqi=&aql=&oq=&fp=2651649a33cd228 no critical errors in google webmaster tools any idea how can I fix it? thanks
Technical SEO | | Yaron530