.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
-
Should I write the keywords in the post, with ou without prepositions
Hi, I have heard from many sources about the semantic and grammatical evaluation of google, this raised a question: when I put a keyword in my text should I put it with or without the prepositions? For example "doctor in Miami" or "doctor miami".
Technical SEO | | droliverulson0 -
Problem with Google SERPS
I am running yoast SEO plugin in WP. I just noticed when I google the client, none of their meta data is showing. I see that I had facebook OG clicked, which looks like it made duplicates of all the titles etc. Would that be the problem? I have since turned it off. I am hoping that was the problem. Also, when the client searches it says in the meta desc - you've viewed this site many times". What is that?
Technical SEO | | netviper0 -
Duplicate content problem?
Hello! I am not sure if this is a problem or if I am just making something too complicated. Here's the deal. I took on a client who has an existing site in something called homestead. Files cannot be downloaded, making it tricky to get out of homestead. The way it is set up is new sites are developed on subdomains of homestead.com, and then your chosen domain points to this subdomain. The designer who built it has kindly given me access to her account so that I can edit the site, but this is awkward. I want to move the site to its own account. However, to do so Homestead requires that I create a new subdomain and copy the files from one to the other. They don't have any way to redirect the prior subdomain to the new one. They recommend I do something in the html, since that is all I can access. Am I unnecessarily worried about the duplicate content consequences? My understanding is that now I will have two subdomains with the same exact content. True, over time I will be editing the new one. But you get what I'm sayin'. Thanks!
Technical SEO | | devbook90 -
Htaccess redirect with question mark
Hi I have a problem setting up my htaccess for a specific page that has a question mark in the link, and one that has a space in the link and also a question mark. So I would like 2 redirects in my htaccess like that: www.olddomain.com/page.php?page=pagename1 to www.newdomain.com/newpage1.html www.olddomain.com/page.php?page=page name2 to www.newdomain.com/newpage2.html I have tried with something like this but doesn't work: RewriteEngine on RewriteRule ^page.php?page=pagename1 "http://www.newdomain.com/newpage1.html" [R=301,L] RewriteRule ^page.php?page=page name2 "http://www.newdomain.com/newpage2.html" [R=301,L] Could someone tell me what exactly I have to change? Thanks
Technical SEO | | darkanweb0 -
What factors matters the most when using a 301 permanent redirect?
Hi SEOmozzers, I have a client that has couple of duplicates but I am debating if i should just kill those pages or use 301 Permanent redirects. I know SEO moz provides 2 important factors to look at which are PA and link root domain. 1.Which one matters the most? or which one should I look at first to make a decision? 2. I have empty pages creating duplicate content with a PA of 14 and 1 linking root domain. my thought is to kill the page by inserting a meta NO INDEX. If you don't agree and think I should 301 to an existing page that needs link juice, let me know. Thank you mozzers 🙂
Technical SEO | | Ideas-Money-Art0 -
Wordpress Canonical Problem
I'm using wordpress for my website but m unable to implement Canonical tag property for pages under the same category, Like for matt's blog: The Tag is same .. for all pages under that category: http://www.mattcutts.com/blog/type/googleseo/ & http://www.mattcutts.com/blog/type/googleseo/page/2/ is it some hack or some plugin ? please suggest! thanks
Technical SEO | | AnkitRawat0 -
Rel Canonical problem or SEOmoz bug ?
Hello all, I hope that sombody out there could help me with my question. I am very new in SEO and in SEOmoz community. I am not familiar with coding. I am goining to start learning soon enough but till now I now only basics. At the website where I am trying to optimize for SEO I am reciving this Crawl Diagnostic Programme. Issue: Rel Canonical (Notice) not Error I searched and lerned what it is. So I contact the developers of the website. Build in wordpress and ask them how to corrected ? They told me that they are using Canonical Tags to all their pages and have no idea why SEOmoz keep identifining it as a "notice" They also tel me to check the source code of page to see the canonical tag. I did and their is actuall a canonical tag there. Cjeck please here www.costanavarinogolf.com So do you have any idea why this is happening ? could you help me explaiin to developers what they should do to overcome this ? Or it's just a bug of SEOmoz and not a reall problem exist ? Thank you very much for your time
Technical SEO | | grzontan0 -
Problem of printer friendly version.
For one of our client's side, most of the backlinks are going to printer friendly version page. I recommeded to him to use the canonical tag on printer friendly version pointing to other page. Luckily, while searching i came across this posts at - http://www.seomoz.org/q/solving-printer-friendly-version The solution recommended was this - <link type="text/css" rel="stylesheet" media="print" href="our-print-version.css"> My questions are - 1. what should i write in place of our-print-version.css Should it be print.css ? 2. Where do i place this code ? in which file ?
Technical SEO | | seoug_20050