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
-
DNS Prefetching for wordpress site
We have given below as DNS prefetch in our website. CMS is wordpress. Are these okay? I wonder why fonts.googleapis.com is not working. One of our competitors is using youtube. Can we improve it any how?
Web Design | | vtmoz0 -
Affects of a Home Link 301 Permanent Redirect in the Main Nav Bar
Hi I created a home page link in the main nav bar using functions.php request, and this leads to the home page, and it works fine. The logo on the site when clicked, resolves the home page domain.com which is fine. Is it ok to have a home page link in my main nav bar, as well as a clickable logo which on-click returns the web user to the home page also? (any seo implications with the permanent 301 redirects?) I like to give web users the choice especially as not all users are aware that they can click back to the home page by clicking on the logo. I considered breadcrumbs already. Thanks.
Web Design | | SEOguy10 -
Spanish website indexed in English, redirect to spanish or english version if i do a new website design?
Hi MOZ users, i have this problem. We have a website in Spanish Language but Google crawls it on English (it is not important the reasons). We re made the entire website and now we are planning the move. The new website will have different language versions, english, spanish and portuguese. Somebody tells me that we have to redirect the old urls (crawled on english) to the new english versions, not to the spanish (the real language of the firsts). Example: URL1 Language: Spanish - Crawled on English --> redirect to Language English version. the other option will be redirect to the spanish new version, which the visitor is waiting to find. URL1 Language: Spanish - Crawled on English --> redirect to Language Spanish version. What do you think? Which is the better option?
Web Design | | NachoRetta0 -
On-page SEO opinion on this Wordpress theme
Hi everyone. As an SEO agency we've been moving more toward genesis themes, however we have a client who really wants to redesign his website using the following theme: http://themeforest.net/item/this-way-wp-full-videoimage-background-with-audio/943634 - the theme would be images with no audio on the homepage. He is a remodeling contractor and likes the design and functionality of the theme. I'd like to get others feedback and opinions on what you think about the on-page SEO of this theme? Thanks.
Web Design | | WillWatrous0 -
How to Redirect Old Domain to a New Domain?
One of my clients has chosen a new domain for her website so we will redirect the old domain to the new. I understand that once redirected, most of the authority built up over the years for the old domain will pass through to the new domain. Is this correct? Can this be done through the Wordpress dashboard, say with a plugin perhaps? I have a plugin called 404 Redirected I was going to try to use for this purpose. Finally, the client has other domains (5 total) she has used for one reason or another. She wants to consolidate all of them and have everything redirected to her new domain. Do you see any downside to this in terms of crawling, Google trust and authority? I know there are some user experience issues to deal with, but we're addressing those. I just don't want to do anything that may cause Google not to trust the new domain. Thanks, Dino
Web Design | | Dino640 -
Optimizing a Wordpress Blog For SEO
Besides the standard Yoast for SEO plugin tweaks, I'm researching best practices when setting up a wordpress blog. In this instance, the "front end" of the site would be hardcoded static pages designed for an e-commerce site, while there would also be a /blog/ attached to the site - for blog posts, fresh content, etc.
Web Design | | GKLA0 -
Is there a Consultant out there to help convert C#.net functions into PHP Wordpress functions?
We are going through a transition from SiteFinity (C# .net windows environment) to WordPress (PHP Linux environment). We currently have custom forms that make calls to webservices and also store data into SQL Server tables. Not sure how to do this in PHP and could use some help. We are located in Irvine, CA. We would prefer someone onsite, but can also work with someone remote if we must. Time is of the essence. Thanks.
Web Design | | balboafinance0 -
Wordpress or Joomla member function - HELP!
Does anyone know of a plugin/theme/template that would allow me to create a site with the following features: 1 section of content that is public 1 section of content that is only for registered members and that is hidden until you log in. A registration page A sign up form
Web Design | | MassivePrime0