Php mod rewrite with$\u get works但不适用于子文件夹
我现在的工作是: webshop/index.php?page=homePhp mod rewrite with$\u get works但不适用于子文件夹,php,.htaccess,mod-rewrite,Php,.htaccess,Mod Rewrite,我现在的工作是: webshop/index.php?page=home 试试这个,你可以返回多个参数 Options +FollowSymLinks -MultiViews RewriteEngine On RewriteBase /webshop/ RewriteCond %{THE_REQUEST} /index\.php [NC] RewriteRule ^(.*?)index\.php$ /$1 [L,R=302,NC,NE] RewriteCond %{REQUEST_FILE
试试这个,你可以返回多个参数
Options +FollowSymLinks -MultiViews
RewriteEngine On
RewriteBase /webshop/
RewriteCond %{THE_REQUEST} /index\.php [NC]
RewriteRule ^(.*?)index\.php$ /$1 [L,R=302,NC,NE]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} ^/([^/]+)/?([^/]*)? [NC]
RewriteRule .* index.php?page=%1&route=%2 [L]
到底是什么问题?我想在子文件夹中排序页面,如:帐户容器登录注册等。我想要的链接是webshop/account/login webshop/account/login
<?php
if (isset($_GET['page'])) {
$page = $_GET['page'];
} else {
$page = 'home';
}
if (strpos($page, '/') !== false || !file_exists("pages/$page.php")) {
$page = 'error';
}
include ("pages/$page.php");
?>
Options +FollowSymLinks -MultiViews
RewriteEngine On
RewriteCond %{THE_REQUEST} /index\.php [NC]
RewriteRule ^(.*?)index\.php$ /$1 [L,R=302,NC,NE]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^webshop/([^/]*)$ /webshop/?page=$1 [L]
Options +FollowSymLinks -MultiViews
RewriteEngine On
RewriteBase /webshop/
RewriteCond %{THE_REQUEST} /index\.php [NC]
RewriteRule ^(.*?)index\.php$ /$1 [L,R=302,NC,NE]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} ^/([^/]+)/?([^/]*)? [NC]
RewriteRule .* index.php?page=%1&route=%2 [L]