3 回答
TA贡献1825条经验 获得超6个赞
试试这个(如果你想使用 images/js/css/.. 稍后也很有用)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)\.(gif|jpg|png|jpeg|css|js|swf)$ /$1.$2 [END,NC]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule ^(.*)$ index.php?$1 [L,QSA]
提示:您可以组合大小写“/”和”
<?php
$request = $_SERVER['REQUEST_URI'];
echo $request;
switch ($request) {
case '/' :
case '' : // you can combine the cases '/' and ''
require __DIR__ . '/views/home.php';
break;
case '/about' :
require __DIR__ . '/views/about.php';
break;
default:
http_response_code(404);
require __DIR__ . '/views/404.php';
break;
}
TA贡献1813条经验 获得超2个赞
将 .htaccess 规则更改为
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
TA贡献1826条经验 获得超6个赞
打开位于此处的 httpd-vhosts.conf 文件:C:\XAMPP\apache\conf\extra\httpd-vhosts.conf
在目录标记下添加以下行:
AllowOverride All
- 3 回答
- 0 关注
- 117 浏览
添加回答
举报