用多个斜杠重写index.php的所有链接
我在网上搜索了我的问题的解决方案,但找不到。所以我想重定向(重写规则)到index.php的所有链接,如: localhost、localhost/x、localhost/x-y、localhost/x-y/z 我读了关于它和我的.htaccess fle:用多个斜杠重写index.php的所有链接,php,html,css,.htaccess,mod-rewrite,Php,Html,Css,.htaccess,Mod Rewrite,我在网上搜索了我的问题的解决方案,但找不到。所以我想重定向(重写规则)到index.php的所有链接,如: localhost、localhost/x、localhost/x-y、localhost/x-y/z 我读了关于它和我的.htaccess fle: RewriteEngine on RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php [NC,L]
问题在哪里?我的CSS文件有问题,它位于includes/CSS/style.CSS中。当链接是这样的:localhost或localhost/x时,一切都正常,但当我添加更多斜杠时,文件不会加载
本部分的HTML:
<link href="./includes/css/basicstyle.css" type="text/CSS" rel="Stylesheet">
我知道这个问题对很多人来说很容易,但我试了两天,没有任何进展
这是wordpress正在使用的
RewriteRule ^(wp-(content|admin|includes).*) $1 [L]
RewriteRule ^(.*\.php)$ $1 [L]
RewriteRule . index.php [L]
也许这会有帮助
RewriteRule ^(includes).*) $1 [L]
RewriteRule ^(.*\.php|.*\.css|.*\.js)$ $1 [L]
RewriteRule . index.php [L]
但我不得不说,我对mod rewrite没有太多经验,但希望它能有所帮助:)非常感谢Mephiztopheles:)您的代码需要替换。/includes to/includes,但它正在工作。再次非常感谢:)很好:)总是乐于助人