2012-05-22 29 views

回答

1

这是我常用的.htaccess文件。我将它转发到index.php,但将其更改为.html,它应该工作相同。

Options +FollowSymLinks 
IndexIgnore */* 
RewriteEngine on 
# if a directory or a file exists, use it directly 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
# otherwise forward it to index.html 
RewriteRule . index.html 
+0

我在哪里保存.htaccess文件? – user1174762

+0

在您的基本目录中,您wwwroot /。只需打开记事本,复制并粘贴,将其保存为.htaccess并上传。 –

+0

这会将除现有文件或目录以外的所有内容都发送到index.html - 不确定OP是否需要这样做。他只想将matt的URI重写为index.html – Ansari

1

此规则在.htaccess文件应该已经足够了:

RewriteEngine on 
RewriteRule ^matt/?$ index.html [NC,QSA] 

放入文档根目录文件。