I;ve got a doman alias setup for one of my WordPress sites and i’m trying to forward that particular domain to a page.
The 2 domains are –
www.alias.com
www.actual.com
When people use the www.alias.com domain i want them to be forwarded to www.alias.com/content/
I’ve tried several things with the htaccess file but i think Worpdress may be ignoring the redirects or i’ve got it completely wrong!
ie
Redirect 301 www.alias.com http://www.alias.com/content/
# and
RewriteCond %{HTTP_HOST} ^www.alias.com
RewriteRule (.*)$ http://www.alias.com/content/ [R=301,L]
best, Dc
First off — does your server allow overrides in
.htaccess
files? If not, you need to get that turned on. My server hasAllowOverride All
set in its config file, which then allows my.htaccess
rules to function.Does
alias.com
point to the same directory asactual.com
? If not, then you need to put a.htaccess
file in thealias.com
root.Also, if I understand your requirements correctly, the
.htaccess
file foralias.com
needs to contain this:References
Apache’s Config File &
URL Rewriting docs
I also have a mod_rewrite from http://www.ilovejackdaniels.com/ but that site seems to be down now.
Since this is a WordPress question and still on the first position in Google, I’ll add a not-so-technical solution for the scenario:
Today there are redirect-plugins that you can use – no need to modify an htaccess file or other server configuration.
WPMU DEV SmartCrawl
I use SmartCrawl for those cases, like this:
Related Links
Note: I’m not affiliated with WPMU DEV, I just like their products.