我有一个想重写的网址,因为菜鸟开发人员的编程不好。
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;
}
所以可以说我有index.php,about.phpgeneral folder
<a href="<?php fetchdir($gpages); ?>index.php">Home</a>
<a href="<?php fetchdir($gpages); ?>contact.php">Home</a>
但问题出在网址中
http://www.urltest.x10.mx/lwh/general/index.php
http://www.urltest.x10.mx/lwh/booking/car.php
我的问题
我如何重写 url,以便当您单击其中的任何链接时,general folder
它就像
http://www.urltest.x10.mx/index.php
它booking folder
会像这样http://www.urltest.x10.mx/booking/car.php
当您单击任何链接时,我想重写 url。
我试过 *在我的根目录*
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
文件夹,但是当我点击一个链接时,我仍然得到填充网址......
请有人帮忙