-1
好的,所以当用户输入www.shareit.me/matt我想它把他们带到www.shareit.me/index.html我该怎么做?URL转发到索引页
好的,所以当用户输入www.shareit.me/matt我想它把他们带到www.shareit.me/index.html我该怎么做?URL转发到索引页
这是我常用的.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
此规则在.htaccess文件应该已经足够了:
RewriteEngine on
RewriteRule ^matt/?$ index.html [NC,QSA]
放入文档根目录文件。
我在哪里保存.htaccess文件? – user1174762
在您的基本目录中,您wwwroot /。只需打开记事本,复制并粘贴,将其保存为.htaccess并上传。 –
这会将除现有文件或目录以外的所有内容都发送到index.html - 不确定OP是否需要这样做。他只想将matt的URI重写为index.html – Ansari