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
-
Wordpress Tag Organization Tips
Curious if anyone has some good examples of ways to organize your WordPress tags without making your sidebar a football field long and hard to navigate. My blog is https://karmahill.com/blog and I could use some ideas. We have main categories of photo shoot types, for example, "Couples", located on the sidebar. We want to add tags to go with those main categories for further categorization and user experience example: Couples Engagement Proposals Honeymoon Maternity My question is, do I need to make "tag" pages for those posts to reside on or is their another way to get it done with less work, that is much faster? I don't want to have to make 30 tag pages or is that just what you have to do?
Web Design | | photoseo13 -
Should I do multiple 301 redirects?
We launched our website less than a year ago. We had another domain name and business name. I created 301s from the old domain to the new domain, that are still in place now. We are in the process of restructuring our current site which would result in pages getting a new title and URL to match. Essentially it would look something like this:
Web Design | | MAVENTRI
-- olddomain.com/page1 --> newdomain.com/page1 --> newdomain.com/newpage I recently checked the analytics and it looks like we are still getting traffic redirected from the old domain. What is the best way to handle these redirects? Should I redirect a redirect?0 -
Anybody with a business site using Webflow CMS or another non-WordPress CMS/ sitebuilder?
If you have built your business site using Webflow CMS, kindly share your insights on how good their CMS is for SEO and how easy it is to rank a site. If you are not familiar with Webflow but have had a positive experience with another non-WordPress CMS/ sitebuilder, kindly share your opinions.
Web Design | | Blu_Ocean99.0 -
Should I Kill the Old Domain or Work Through the Redirect?
Our IT department wasn't able to create a new directory on the current domain name for whatever reason and so we had to create a new domain name called ww2.domain.com to build the new site. So now we have the new site up and appartly some PDFs and pages are being directed to the from the old site. www.domain.com but 10,000 pages /PDFs are still indexed in Google and are not redirected. So when you open the page you get the old www.domain.com instead of it redirecting to ww2.domain.com. It's sort of a mess! My question is can we just kill the old domain name and move the ww2.domain.com back to the old domain? We also want to do away with the ww2.domain.com and go back to www.domain.com. I know it's confusing as heck! What would you recommend?
Web Design | | Eagle-ABS0 -
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 -
Best way to develop a WordPress version of your site and then move it?
I have two websites that generate hundreds of organic hits each day. I want to switch both of them to WordPress. What is the best way to go about developing these sites then making them live while still keeping the current ones up?
Web Design | | C-Style0 -
Is it necessary to redirect every Error page (404 or 500) found?
If I have Hundreds of pages with 404 and 500 erros should set up 301 redirects for all of them? Some of the pages have external links, some don't.
Web Design | | jmansd0