最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

redirect - forward domain name to particular page?

programmeradmin2浏览0评论

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 www.actual When people use the www.alias domain i want them to be forwarded to www.alias/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 /

# and
RewriteCond %{HTTP_HOST} ^www.alias
RewriteRule (.*)$ / [R=301,L]

best, Dc

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 www.actual When people use the www.alias domain i want them to be forwarded to www.alias/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 http://www.alias/content/

# and
RewriteCond %{HTTP_HOST} ^www.alias
RewriteRule (.*)$ http://www.alias/content/ [R=301,L]

best, Dc

Share Improve this question asked May 21, 2013 at 14:25 v3ntv3nt 1,6897 gold badges36 silver badges54 bronze badges
Add a comment  | 

2 Answers 2

Reset to default 2

First off -- does your server allow overrides in .htaccess files? If not, you need to get that turned on. My server has AllowOverride All set in its config file, which then allows my .htaccess rules to function.

Does alias point to the same directory as actual? If not, then you need to put a .htaccess file in the alias root.

Also, if I understand your requirements correctly, the .htaccess file for alias needs to contain this:

RewriteEngine On
RewriteCond %{HTTP_HOST} ^www.alias$ [NC]
RewriteRule ^(.*)$ http://www.actual/content/ [R=301,L]

References

Apache's Config File & URL Rewriting docs

I also have a mod_rewrite from http://www.ilovejackdaniels/ 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

  • https://wordpress/plugins/smartcrawl-seo/ (free version, can do those redirects)
  • https://premium.wpmudev/project/smartcrawl-wordpress-seo/ (premium version for WPMU DEV members)

Note: I'm not affiliated with WPMU DEV, I just like their products.

发布评论

评论列表(0)

  1. 暂无评论