Apache 修改重写->;不';I don’我没有按预期工作

Apache 修改重写->;不';I don’我没有按预期工作,apache,mod-rewrite,Apache,Mod Rewrite,我使用以下.htaccess将所有请求重定向到my index.php,除非存在文件夹或文件 RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ index.php?uri=$1 [QSA] 但如果我尝试像domain.com/thing/a/thing/b这样的url,我会被重定向到index.php,但其他一切都会一团糟

我使用以下.htaccess将所有请求重定向到my index.php,除非存在文件夹或文件

RewriteEngine On

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule ^(.*)$ index.php?uri=$1 [QSA]

但如果我尝试像domain.com/thing/a/thing/b这样的url,我会被重定向到index.php,但其他一切都会一团糟。html没有正确链接到样式表等等

我的应用程序工作起来有点像MVC框架,也就是说,一切都是在index.php上发生的。所以我不希望其他文件可以访问,除了公用文件夹中的文件和一些特定的文件。即根目录中的cron.php和文件夹结构中的一些css/js/image文件

有关文件结构的更多详细信息:


或者我必须用绝对路径链接样式表和其他东西,例如http://domain.com/path/to/style.css“等等?

(.*)$index.php?uri=$1
之前使用斜杠客户端

使用此代码:

RewriteRule ^/client(.*)$ index.php?uri=$1

您需要将所有链接更改为绝对链接或添加

<base href="http://domain.com/">


到页面的页眉。

htaccess文件中通过的URI
RewriteRule
去掉了前导斜杠(从v2开始),这永远不会匹配htaccess文件中的任何内容。