如何重写网址?

时间:2013-03-07 05:17:10

标签: php .htaccess rewrite

1 个答案:

答案 0 :(得分:4)

使用.htaccess

RewriteEngine On
RewriteRule ^nano/$ index.php [L]

<强>被修改

如果您想访问子文件夹,那么您必须制作如下所示的htaccess文件

RewriteEngine on
RewriteCond %{HTTP_HOST} ^(www.)?yourdomain.com$ [NC]
RewriteCond %{REQUEST_URI} !^/nano/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /nano/$1
RewriteCond %{HTTP_HOST} ^(www.)?yourdomain.com$ [NC]
RewriteRule ^(/)?$ nano/index.php [L]