简体   繁体   中英

htaccess subdomain redirect when specific script is called

I need when an specific page is called with a subdomain it redirects to www.

I can give you an example:

nuevoleon.domain.com/empresa/

I need that the correct url for SEO purposes is:

www.domain.com/empresa

Put this code in your DOCUMENT_ROOT/.htaccess file:

RewriteEngine On

RewriteCond %{HTTP_HOST} ^nuevoleon\.domain\.com$
RewriteRule ^ empresa(/|$) http://www.domain.com%{REQUEST_URI} [L,R=301]

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM