.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
-
Pros and Cons of using rel=next on blog posts
Hi there, at the bottom of my website's blog posts the rel=prev and rel=next tags are used on links that point to the previous article that was posted and the next article that was posted. Often these articles are not 'linked' in terms of their content or message. Is this the correct use of rel=next/prev and if not what are the possible negative effects. Many thanks.
Technical SEO | | Bee1590 -
How to use robots.txt to block areas on page?
Hi, Across the categories/product pages on out site there are archives/shipping info section and the texts are always the same. Would this be treated as duplicated content and harmful for seo? How can I alter robots.txt to tell google not to crawl those particular text Thanks for any advice!
Technical SEO | | LauraHT0 -
Should we change the publish date in WordPress when updating a post?
Hi everyone, We're going through some of our old posts in our WordPress blog and updating them, adding new information, new links, and photos. My question: If we update the posts significantly, should we also update the "published" date to today? If we only correct some typos or a dead link, we don't touch the date. However, if we've done some real work on the post, we'd like to update the published date in order to bring it to the top of our blog feed and draw new attention to the post. However, I'm a little nervous that this could be seen by Google as spammy, as it's not technically a new post and the URL already exists in Google's index of our site. Here's an example of a post that was published several years ago and then updated a few week's ago with new information (and a new date stamp): http://www.eurocheapo.com/blog/barcelona-tip-five-cheap-eats-under-e6.html Any thoughts on this? Thanks, Tom
Technical SEO | | TomNYC0 -
How can I index several systems used for my website?
My site is built on PHP, but has a help.website.com page based on a helpdesk platform. I also have a wordpress blog. So, these are three "different systems" under the same domain. When I crawl my site, neither the blog nor the help page show up. How can I make them show up? Thanks!
Technical SEO | | rodelmo880 -
Google description showing latest post excerpt
In doing a search for our website, The Tech Block, I realized that our description is not showing what we have in our Yoast settings, but rather the content from the slider: http://d.pr/i/kGjB What can I do to fix this?
Technical SEO | | ttb0 -
When criteria do you use for external linking?
When linking out to external sources what criteria do you use? Also, do you ever add the URL in plain text instead to conserve link juice?
Technical SEO | | Charlessipe0 -
Using symbols in the html title of a webpage
If you a symbol in the title of a webpage will this dilute the keywords in the title
Technical SEO | | mickey11
thus making it rank worse in search engines here is an example <title><br /> Black Shoe Polish<br /></title> versus <title><br /> ▶ Black Shoe Polish<br /></title> will the extra symbols count as words and thus the dilute the effectiveness of the Black Shoe Polish keyword. sort of making like 4 words instead 3. By the way, The reason to use a symbol is to make it stand on in the search engine results0 -
Comments in slider using display: none
What is the best way to get comments indexed that are hidden in a slider using display: none? For example: http://www.coupondudes.com/stores/kmart.com Click on "Add comment" Is there a way to do this without changing the design? If not, should we create a page per coupon with the comments shown. Will that pose duplicate content issues? 20110512-qg1ra18k9khdsqi6j3rkq4dfgb.jpg
Technical SEO | | 58phases0