.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
-
Google Not Picking Up Posts
I am trying to work out why from March 4th Google is not seeing my posts. Our google impressions have dropped from 8,000 to 40. If you put in the full article name with speach marks it does not find it, and instead shows the home page in google. We have not had any warnings. We did have work done on our site but nothing else i could think of to cause this. Can anyone let me know what may have caused this. All articles are original
Technical SEO | | headlinesplus0 -
Am I using pagination markups correctly?
Hey Mozzers! I am receiving duplicate title tag errors from Search Console on paginated pages (blog.com/chlorine, blog.com/chlorine-2, blog.com/chlorine-3). I do not currently have a view all page. If I were to create one, would I add all the content from chlorine-2 and chlorine-3 to the blog.com/chlorine page? Then use the rel=cononical on chlorine-2 and chlorine-3 to blog.com/chlorine? If I move forward without the view all page, I could implement the next/prev HTML markups but can I do this without dev help? I am currently using the Yoast SEO plugin and do not see the option. Would I use the text editor to add the markups directly before the content? I think I have a grasp on this, but this will be my first time implementing and I want to double check first! Thanks!
Technical SEO | | localwork0 -
Problem with Wordpress RSS feed and Feedburner
Just discovered a problem with my company site's RSS feed. I'm a bit embarrassed to ask, but I thought someone in the community might have encountered this -- and I cannot figure it out for the life of me! We had redirected our Wordpress feed to Feedburner. We publish at least once per week, but no posts after March 18 are in the feed: http://feeds.feedburner.com/TheClineGroup The standard (Wordpress) RSS feed page does not load: http://theclinegroup.com/feed/ Of course, I deactivated all plug-ins to see if one of them was the issue, but the problem(s) still existed. Thanks so much for any assistance!
Technical SEO | | SamuelScott0 -
Duplicated content in news portal: should we use noindex?
Hello, We have a news portal, and like other newspapers we have our own content and content from other contributors. Both our content and our contributors content can be found in other websites (we sell our content and they give theirs to us). In this regard, everything seems to work fine from the business and users perspective. The problem is that this means duplicated content... so my question is: "Should we add the noindex,nofollow" tag to these articles? Notice that there might be hundreds of articles everyday, something like a 1/3 of the website. I checked one newspaper which uses news from agencies, but they seem not to use any noindex tag. Not sure what others do. I would appreciate any opinion on that.
Technical SEO | | forex-websites0 -
What's the best canonicalization method?
Hi there - is there a canonicalization method that is better than others? Our developers have used the
Technical SEO | | GBC0 -
Cross-Domain Canonical - Should I use it under the following circumstances?
I have a number of hyper local directories, where businesses get a page dedicated to them. They can add images and text, plus contact info, etc. Some businesses list on more than one of these directory sites, but use exactly the same description. I've tried asking businesses to use unique text when listing on more than one site to avoid duplication issues, but this is proving to be too much work for the business owner! Can I use a cross-domain canonical and point Google towards the strongest domain from the group of directories? What effects will this have? And is there an alternative way to deal with the duplicate content? Thanks - I look forward to hearing your ideas!
Technical SEO | | cmaddison0 -
Using Blogger.com
I have a client that is currently using blogger.com for their blog. I don't have much experience with this site as I have mostly used Wordpress in the past. Are there any good SEO plugins/tools for this site? Thanks!
Technical SEO | | AlightAnalytics0 -
Problem generating backlinks
Hello everyone, Over the past couple of days I have been using a variety of different free and paid programs to check how many backlinks I have. I have used at least 15 different ones, SEOmoz is the newest and am awaiting those results. All but one of those programs have said that I have 0 backlinks. The one said I have 11. The thing is...over the past month I have submitted my site to over 500 PR0 directories, 250+ PR3-PR7 directories, have made well over 75 article submissions to over 20 websites(almost all of them were approved and up and running, and some of these websites have a PR of 7), a couple dozen Press Releases, set up profiles linking to my site on over 50 forums, set up profiles linking to my site on a variety of different Web 2.0 sites, and still nothing. I have been doing this every day for over a month. Anyone have any ide?
Technical SEO | | tarik30010