Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/40.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
在PHP MVC项目中引入.htaccess文件_Php_Css_.htaccess - Fatal编程技术网

在PHP MVC项目中引入.htaccess文件

在PHP MVC项目中引入.htaccess文件,php,css,.htaccess,Php,Css,.htaccess,我最近开始研究mvc。我的问题是css文件的识别。 当我添加行时 RewriteRule ^([^\/]*)/([^\/]*)$ index.php?page=$1&id=$2 [L,QSA] 对于.htaccess文件,另一个css文件不知道。但是什么时候改成 RewriteRule ^(.*)$ index.php?page=$1 [L,QSA] 它很好用 这是我的.htaccess文件的详细信息 RewriteEngine on RewriteCond %{REQUES

我最近开始研究mvc。我的问题是css文件的识别。 当我添加行时

RewriteRule ^([^\/]*)/([^\/]*)$ index.php?page=$1&id=$2 [L,QSA]
对于.htaccess文件,另一个css文件不知道。但是什么时候改成

RewriteRule ^(.*)$ index.php?page=$1 [L,QSA]    
它很好用

这是我的.htaccess文件的详细信息

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !\.(css|pdf|gif|ico|jpg|js|png|swf|pdf|txt|php)$
RewriteRule ^([^\/]*)/([^\/]*)$ index.php?page=$1&id=$2 [L,QSA]
RewriteRule ^(.*)$ index.php?page=$1 [L,QSA]
我能做些什么来解决这个问题试试这个

<IfModule mod_rewrite.c>
RewriteEngine On

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

RewriteRule ^(.*)$ index.php?url=$1 [PT,L]

</IfModule>

重新启动发动机
重写cond%{REQUEST_FILENAME}-F
重写cond%{REQUEST_FILENAME}-D
重写规则^(.*)$index.php?url=$1[PT,L]

它工作正常,但我想在地址方向上使用2步。喜欢sample.com/page/12并使用此模式。