• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

.htaccess redirect help

Babbles

Diamond Member
I hope there is a simple solution, but I am having trouble finding an answer.

I moved my Wordpress install from subdomain to the top-level domain and I would like to do a .htaccess redirect to point the old page locations to their respective new location.

So I want to redirect: blog.website.com/Page01
to: www.website.com/Page01

Currently I have:

Code:
Options -Indexes +FollowSymLinks

RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^WEBSITE.COM/ [NC]
RewriteRule ^(.*)$ http://www.WEBSITE.COM$1 [L,R=301]

RedirectMatch 301 http//blog.WEBSITE.COM/(.*)$ http://www.WEBSITE.COM/$1

This seems to display the content from the new location, but the URL in the browser doesn't update (i.e. keeps blog.website instead of www.website).

Any help?
 
I was looking for a solution to a similar issue and found this on wikipedia
Using .htaccess for redirection

When using the Apache web server, directory-specific .htaccess files (as well as apache's main configuration files) can be used. For example, to redirect a single page:

Redirect /oldpage.html http://www.example.com/newpage.html [R=301,L]

The above format used to work until somewhere around version 2.2.14. In the Apache HTTP server version 2.2.14 it has been found[by whom?] (on three separate servers, not a big sample but better than one) that placing a line of the above format in an .htaccess file causes an Internal Server Error for the entire site. Instead you should use the format dictated by the Apache Foundation [6] such as:

Redirect permanent /oldpage.html http://www.example.com/newpage.html
Redirect 301 /oldpage.html http://www.example.com/newpage.html
 
Just use the same format as you are already using for your first redirect.

Code:
RewriteCond %{HTTP_HOST} ^blog.example.com [NC]
RewriteRule ^(.*)$ http://www.example.com/$1 [L,R=301]

What you are wanting to do (changing the URL that is displayed) is known as an external redirect (as opposed to internal redirect).
 
Back
Top