Apache将“domain.com/folder”重写为“folder.domain.com”,并保持从“folder.domain.com”重定向到“domain.com/folder"

时间:2018-02-20 16:44:49

标签: apache .htaccess url-rewriting url-redirection

我希望folder.domain.com指向domain.com/folder

我希望domain.com/folder在浏览器的页面网址中重写为folder.domain.com

在这两种情况下,我都希望看到这样的网址folder.domain.com

尝试:

Redirect 301 /subdomain http://subdomain.example.com

既不工作:

RewriteCond %{THE_REQUEST} ^GET\ /ucp/profile\.php?([^=]+)=(\S+) [NC]
RewriteRule ^ucp/profile\.php$ /ucp/%1/%2? [R=301,L,NC]

# Now, deal with internal rewrites (which will not cause redirection):
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^ucp/([^/]+)/([^/]+)/?$ /ucp/profile.php?$1=$2 [NC,L]
enter code here

还有更多。

甚至可以实现吗?

0 个答案:

没有答案