Php Htaccess代码重定向到XAMPP索引页
我正在尝试编写htaccess代码,将直接链接文件(例如图像和css文件)之外的所有URL重定向到index.php文件进行处理Php Htaccess代码重定向到XAMPP索引页,php,apache,.htaccess,mod-rewrite,redirect,Php,Apache,.htaccess,Mod Rewrite,Redirect,我正在尝试编写htaccess代码,将直接链接文件(例如图像和css文件)之外的所有URL重定向到index.php文件进行处理 http://localhost/testsite/login 重定向到 http://localhost/testsite/index.php?cmd=login 但是htaccess代码将我重定向到XAMPP主页。这是我的密码 DirectoryIndex index.php RewriteEngine on RewriteCond %{REQUEST_FI
http://localhost/testsite/login
重定向到
http://localhost/testsite/index.php?cmd=login
但是htaccess代码将我重定向到XAMPP主页。这是我的密码
DirectoryIndex index.php
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+)$ /index.php?cmd=$1 [QSA,NC,L]
我做错了什么?从目标中删除
/
,并使用适当的重写库
:
DirectoryIndex index.php
RewriteEngine on
RewriteBase /testsite/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+)$ index.php?cmd=$1 [QSA,L]
/index.php
将其路由到当前目录中的站点根index.php
,而不是index.php
。重写库/testsite/