WordPress and Redirects
-
I just converted my site to wordpress. Previously urls like www.waikoloavacationrentals.com/kolea-rentals/9g and www.waikoloavacationrentals.com/kolea-rentals/9g.html would go to the same page. Since using wordpress the first one will not work. I did not have redirects set up so was wondering if there is something I am forgetting to easily make it to where if someone types in both urls it will go to the same page.
-
Pages load correct at: http://www.waikoloavacationrentals.com/kolea-rentals/9g.html
And do not load at: http://www.waikoloavacationrentals.com/kolea-rentals/9g
So you need to Redirect http://www.waikoloavacationrentals.com/kolea-rentals/9g TO http://www.waikoloavacationrentals.com/kolea-rentals/9g.html
You can do this with the line of code in .htaccess
Redirect 301 /kolea-rentals/9g http://www.waikoloavacationrentals.com/kolea-rentals/9g.html
Let us know if that works?
You can also try the redirect plugin, although personally I prefer using .htaccess for redirects
-
Still no luck on this one if anyone else has any insight.
-
I sent it over.
-
Mind PMing me your. Htaccess?
-
That is what I originally had. I put it back.
<ifmodule mod_rewrite.c="">RewriteEngine On
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /html/(.).html\ HTTP/
RewriteRule . http://localhost/html/%1 [R=301,L]
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /html/(.)\ HTTP/
RewriteRule . %1.html [L]</ifmodule>Try clicking on www.waikoloavacationrentals.com/kolea-rentals/9g and you will see what happens. Thanks,
-
don't put your URL in for line 4, keep it as "localhost" like in the example.
-
Yes. I am not getting anything on www.waikoloavacationrentals.com/kolea-rentals/9g
I don't really care which way the rule goes just as long as when they put in either url they get something.
Here is the code incase I typo'd something.
<ifmodule mod_rewrite.c="">RewriteEngine On
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /html/(.).html\ HTTP/
RewriteRule . http://www.waikoloavacationrentals.com/html/%1 [R=301,L]
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /html/(.)\ HTTP/
RewriteRule . %1.html [L]</ifmodule> -
Thanks! Although, yeah, not very easy to play with.
-
The code above will do the opposite.
domain.com/page.html will become domains.com/page
Did you test for that? Usually this is how people prefer their URLs to be, and if they type in the .html, they'll still get to the page.
-
Thanks for the feedbacks. I tried the above code. I also tried a few at the website above and did not have any luck. Just to confirm what I am trying to do......Take a page like www.waikoloavacationrentals.com/kolea-rentals/9g.html. If someone types in www.waikoloavacationrentals.com/kolea-rentals/9g I want it to go to www.waikoloavacationrentals.com/kolea-rentals/9g.html so that they do not get a blank page. It was happening on my old site, but not having the same luck with wordpress. Thanks again!
-
Curly brackets between the unlink and bold portions of the kitchen sink. Apparently you have to make sure you've said what you need to say, because I couldn't find a way to intuitively shut off the block and type.
-
<ifmodule mod_rewrite.c="">RewriteEngine On
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /html/(.).html\ HTTP/
RewriteRule . http://localhost/html/%1 [R=301,L]
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /html/(.)\ HTTP/
RewriteRule . %1.html [L]</ifmodule> -
I've never done this specific rule, but it would definitely be a rewrite rule in your .htaccess file in your root. You can give this piece a shot:
RewriteEngine On
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /html/(.*).html\ HTTP/
RewriteRule .* http://localhost/html/%1 [R=301,L]
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /html/(.*)\ HTTP/
RewriteRule .* %1.html [L]
Jeez.... how do I get rid of all the extra spacing?!
Anyway, if that doesn't work, there are some other options here: http://stackoverflow.com/questions/5730092/how-to-remove-html-from-url
And if you need to customize the regex a bit, this can help: http://www.regexr.com/
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
-
Has anyone transferred a site from WordPress to Webflow?
We're thinking about making the move, but I'm (mildly) concerned about SEO implications.
Web Design | | lauraballer0 -
How to export Wordpress comments ONLY to a new domain
Hi Guys, We have a bit of situation here. We have a website (let's say it is www.oldsite.com) where we had more than 2000 posts. There arose a need whereby we had to move some 60-70 posts from this oldsite.com to another domain of ours (www.newsite.com). So, here is what we did: Move those 60-70 posts manually from oldsite.com to newsite.com Did a 301 redirect of each of those 60-70 posts from oldsite.com to newsite.com. Google has now started to rank the posts from the newsite.com for this. That's all good till now. Now, here comes the situation. We also want to move the comments from some of those posts of oldsite.com (some 10-12 posts out of those 60-70) to the respective posts of newsite.com. How do we do that? Do note that we are pretty comfortable with databases and to some extent PHP. Please help.
Web Design | | seocuppa0 -
Wordpress Plugin To Capture Form Completion Data, Before Visitor Hits "Submit"?
Greetings MOZ Community: Visitors frequently start to enter contact information in the forms on our website, but then chicken out and don't hit the submit button. I noticed this watching the recordings of visitor web site visits using Mouse Flow. Is there a Wordpress Plugin that would allow us to capture data entered in forms, where the visitor does not finally hit the "submit" button? Obviously this would be very, very valuable as this scenario occurs in one out of three or four instances. Thanks!!!
Web Design | | Kingalan1
Alan0 -
Is there a way to redirect URLs with a hash-bang (#!) format?
Hi Moz, I'm trying to redirect www.site.com/locations/#!city to www.site.com/locations/city. This seems difficult because anything after the hash character in the URL does not make it to the server thus cannot be parsed for rewriting. Is there an SEO friendly way to implement these redirects? Thanks for reading!
Web Design | | DA20130 -
Can wordpress actually be bad for sites if it static?
Hello, So last year I did rank for my website. Yet I switched from Adobe Muse to wordpress. I thought it would be great for updating and blobbing if I ever do it. So I got a theme, and went for it I have Yoast and that's it for plugins. But if I take say another couple of years to blog, am I hurting myself with wordpress? Like Google knows I am using wordpress so it expects me to be creating content? I know its an odd question, just had to ask
Web Design | | Berner0 -
Redirecting duplicate pages
For whatever reason, X-cart creates duplicates of our categories and articles so that we have URLs like this www.k9electronics.com/dog-training-collars
Web Design | | k9byron
www.k9electronics.com/dog-training-collars/ or http://www.k9electronics.com/articles/anti-bark-collar
http://www.k9electronics.com/articles/anti-bark-collar/ now our SEO guy says that we dont have to redirect these because google is "smart enough" to know they are the same, and that we should "leave it as-is". However, everything I have read online says that google sees this as dupe content and that we should redirect to one or the other / or no /, depending on which most of our internal links already point to, which is with a slash. What should we do? Redirect or leave it as is? Thanks!0 -
Wordpress drop down menu issue...
While I am tweaking my current site with getting rid of my footer links, my site will not allow a drop down menu for my service area parent page. It will do a drop down menu for any other tab. Could not find anything in a google search besides just link to parent for drop down... Any ideas?
Web Design | | greenjoe0 -
Best Wordpress Hosting
I've had a horrible experience with the security on wordpress hosting with GoDaddy. Someone recommended Blue Host as my next option. Does anyone have any experience with BlueHost and what other hosting companies would you recommend for wordpress hosting?
Web Design | | ChristineCadena0