我有网址:
我该如何制作
http://127.0.0.1/rewritedpath/(index.php)
http://127.0.0.1/rewritedpath/error/1(index.php?error = 1)
我已经死了
RewriteEngine on
RewriteRule ^/?rewritedpath/ /myfolder/index.php
RewriteRule ^/?rewritedpath/error/([0-9]+)$ /myfolder/index.php?error=$1
但这不起作用。这有什么不对?感谢
已更新
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^/?rewritedpath/error/([0-9]+)$ /myfolder/index.php?error=$1 [L]
RewriteRule ^/?rewritedpath/ /myfolder/index.php [L]
答案 0 :(得分:1)
尝试使用以下规则,
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^/?rewritedpath/ /myfolder/index.php [L]
RewriteRule ^/?rewritedpath/error/([0-9]+)$ /myfolder/index.php?error=$1 [L]
答案 1 :(得分:1)
假设你的myfolder位于
/无功/网络/ HTML / MyFolder文件
index.php
.htaccess
.htaccess
文件 RewriteEngine On
RewriteRule ^(.*)$ ../myfolder/index.php?params=$1 [NC]
index.php
文件中
醇>
$get = explode("/",$_GET['params']);
它将解析数组中的所有url参数。