Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/jpa/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
用多个斜杠重写index.php的所有链接_Php_Html_Css_.htaccess_Mod Rewrite - Fatal编程技术网

用多个斜杠重写index.php的所有链接

用多个斜杠重写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 ^(.*)

我在网上搜索了我的问题的解决方案,但找不到。所以我想重定向(重写规则)到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 ^(.*)$ 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,但它正在工作。再次非常感谢:)很好:)总是乐于助人