我有一个我想重写的网址,因为来自noob develper的编程错误 .
php
$branch = "lwh/main/"; // Dirs in URL from host to main folder
$pagebranch = "lwh/"; // URL branch for hyperlinks
$apages = "account/";
$bpages = "booking/";
$gpages = "general/";
$ppages = "product/";
function //全球职能
function fetchdir($dir)
{
$protocol = $GLOBALS['protocol'];
$host = $GLOBALS['host'];
($dir == $GLOBALS['apages'] || $dir == $GLOBALS['bpages'] || $dir == $GLOBALS['ppages'] || $dir == $GLOBALS['gpages'] ? $branch = $GLOBALS['pagebranch'] : $branch = $GLOBALS['branch']);
echo $protocol.$host.$branch.$dir;
}
function fetchinline($dir)
{
$protocol = $GLOBALS['protocol'];
$host = $GLOBALS['host'];
($dir == $GLOBALS['apages'] || $dir == $GLOBALS['bpages'] || $dir == $GLOBALS['ppages'] || $dir == $GLOBALS['gpages'] ? $branch = $GLOBALS['pagebranch'] : $branch = $GLOBALS['branch']);
return $protocol.$host.$branch.$dir;
}
所以我说我在 general folder 有index.php,about.php
但问题在于它将成为网址
http://www.urltest.x10.mx/lwh/general/index.php
http://www.urltest.x10.mx/lwh/booking/car.php
MY question 如何重写网址,以便当您点击 general folder 中的任何链接时,它将像http://www.urltest.x10.mx/index.php
我想在你点击任何链接时重写网址 .
I have tried 在我的根目录
Options +FollowSymlinks
RewriteEngine on
RewriteCond $1 !^lwh/
RewriteRule (.*) /lwh/main/pages/general/$1 [L]
RewriteCond %{REQUEST_URI} !^lwh/
RewriteRule ^(.*)$ lwh/$1 [L]
RewriteCond %{HTTP_HOST} ^urltest.x10.mx [NC]
RewriteRule ^(.*)$ http://www.urltest.x10.mx/$1 [R=301,L]
AuthName "root"
AuthType Basic
require valid-user
Options -Indexes
在 lwh 文件夹中我有
RewriteEngine on
RewriteBase /
RewriteRule ^general/(.*)$ lwh/main/pages/general/$1 [L]
RewriteRule ^account/(.*)$ lwh/main/pages/account/$1 [L]
RewriteRule ^booking/(.*)$ lwh/main/pages/booking/$1 [L]
RewriteRule ^product/(.*)$ lwh/main/pages/product/$1 [L]
RewriteRule ^$ lwh/main/pages/account/ [L]
RewriteRule ^$ lwh/main/pages/general/ [L]
RewriteRule ^$ lwh/main/pages/booking/ [L]
RewriteRule ^$ lwh/main/pages/product/ [L]
ErrorDocument 404 /lwh/main/pages/general/index.php
Options -Indexes
AuthName "main"
隐藏 lwh 文件夹,但当我点击一个链接时,我仍然得到填充网址...
请有人帮忙