在我的网站上,我有这样的东西:
example.pl/index.html and example.pl/gallery.html
我想用htaccess制作网址别名,例如:
example.pl/homepage and example.pl/gallery
我已经找到了删除.html的解决方案,但我想用其他东西重写索引。
RewriteEngine On
RewriteBase /
RewriteRule ^page$ /subfolder/subfolder/thepage.php [L]
我在这里找到的这个解决方案对于 php 问题不起作用。 此外,我应该将.htacess文件放在public_html文件夹或家庭托管目录中吗?(我不在这个简单的网站上使用php和数据库(。
以下是您可以执行的操作:
RewriteEngine On
RewriteRule ^homepage /subfolder/subfolder/index.html [L]
RewriteRule ^gallery /subfolder/subfolder/gallery.html [L]
.htaccess
文件应保留在包含index.html
和gallery.html
文件的文件夹中。