您好我正在尝试使用htaccess更改我的网址,但它不再有效。
http://localhost:8888/cPanel/abc?page=general-settings
RewriteRule ^cPanel/([\w-]+)/?$ abc.php?page=$1 [L,QSA]
我做错了什么人都可以帮助我吗?
我想改变这样的网址:
http://localhost:8888/cPanel/general-settings
<?php
$page ='';
if($_GET['page']){
$page = $_GET['page'];
if($page == 'general-settings'){
include "/pages/general-settings.php" ;
}
}
?>
答案 0 :(得分:1)
错误符合规则。你的实际规则是:
RewriteRule ^cPanel/([\w-]+)/?$ abc.php?page=$1 [L,QSA]
如果你想要cPanel
作为结果,那么缺少http://localhost:8888/cPanel/general-settings
使用此规则(这意味着:当Apache匹配cPanel/*anything*
时,点击资源cPanel/abc.php?page=*anything*
)它应该有效:
RewriteRule ^cPanel/(.*)$ cPanel/abc.php?page=$1 [L,QSA]
答案 1 :(得分:-1)
测试此代码
RewriteEngine on
Options +FollowSymlinks
RewriteRule ^cPanel/(.+)/?$ abc.php?page=$1