【发布时间】:2012-05-06 06:37:29
【问题描述】:
如何重写 URL,所以当我输入时
http://mydomain.com/index.php
与
相同http://mydomain.com/subdomain/index.php
【问题讨论】:
标签: regex apache .htaccess mod-rewrite
如何重写 URL,所以当我输入时
http://mydomain.com/index.php
与
相同http://mydomain.com/subdomain/index.php
【问题讨论】:
标签: regex apache .htaccess mod-rewrite
如果您只想处理 index.php,那么以下操作将起作用:
RewriteEngine On
RewriteRule ^(index\.php|)$ subdomain/$1 [L]
但是,如果您想重定向每个请求 subdomain folder,那么以下将起作用:
RewriteEngine On
RewriteRule ^(?!subdomain/).*$ subdomain%{REQUEST_URI} [L,NC]
【讨论】:
对于所有文件
Options +FollowSymlinks
RewriteEngine on
RewriteRule ^(.+)$ /subdomain/$1 [NC]
【讨论】:
【讨论】: