.htaccess Htaccess-Rerwite-url

.htaccess Htaccess-Rerwite-url,.htaccess,.htaccess,因此,将url从 RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME}\.php -f RewriteRule ^(.*)$ $1.php RewriteRule ^hash/([a-zA-Z0-9_-]+) hash.php?key=$1 [QSA,L] 到 很好 但当我转到hash/anything时,页面中的所有URL都有这个模式 hash/anything/som

因此,将url从

RewriteEngine on 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteCond %{REQUEST_FILENAME}\.php -f 
RewriteRule ^(.*)$ $1.php

RewriteRule ^hash/([a-zA-Z0-9_-]+) hash.php?key=$1 [QSA,L]

很好

但当我转到hash/anything时,页面中的所有URL都有这个模式

hash/anything/some_image.jpg

但我想把所有链接都指向root,因为这是毫无意义的

hash/some_image.jpg


所以,当我导航到不同的散列时,如何将所有链接引用到root

只需在html页面标题中添加以下内容:

 hash/anything
 hash/anything
<base href="/">