|
|
我有個關于網址的問題要問各位:
例:www.abc.com/member/images/
我要如何更換
member --> m
images --> i
而不更改文件存放的位置?
讓'm'代替'member', 'i'代替‘images’ ?
操作系統是Linux,数据库等都是用PHPMyAdmin2.9.2的。 |
|
|
|
|
|
|
|
|
|
|
发表于 9-9-2008 06:42 PM
|
显示全部楼层
|
如果是apache的話可以用mod rewrite... |
|
|
|
|
|
|
|
|
|
|
发表于 9-9-2008 07:56 PM
|
显示全部楼层
|
|
|
|
|
|
|
|
|
|

楼主 |
发表于 10-9-2008 09:13 AM
|
显示全部楼层
原帖由 megablue 于 9-9-2008 07:56 PM 发表
为什么不直接rename directory?
同事说不要改原有的结构,所以就上网求救。
原帖由 cheng1986 于 9-9-2008 06:42 PM 发表 [url=redirect.php?goto=findpost&pid=47842881&ptid=1335812][/url]
如果是apache的話可以用mod rewrite...
那是不是需要碰到conf file?
能不能用coding (PHP)的方式来弄?
谢谢你们的回复…… |
|
|
|
|
|
|
|
|
|
|
发表于 10-9-2008 03:21 PM
|
显示全部楼层
建立 .htaccess file
在 .htaccess file 里贴上以下 code
RewriteEngine On
RewriteRule ^m/i/(.+)\.(.+)$ member/image/$1.$2 [L,NC] |
|
|
|
|
|
|
|
|
|
|
发表于 10-9-2008 05:34 PM
|
显示全部楼层
原帖由 blue333 于 10-9-2008 03:21 PM 发表 
建立 .htaccess file
在 .htaccess file 里贴上以下 code
RewriteEngine On
RewriteRule ^m/i/(.+)\.(.+)$ member/image/$1.$2 [L,NC]
这[ ]里面的东西怎么用的。。为什么有时候放PT,L,QSA...
我今天研究了一整天,还是看不懂。。。
还有,如果是同一个时候有
index.php?target=exhibiting (when no $task/ $task=' ')
index.php?target=exhibiting&task=whoVisits
我要弄成
exhibiting
exhibiting/whoVisits
要怎么写??
[ 本帖最后由 fenjiao 于 10-9-2008 05:36 PM 编辑 ] |
|
|
|
|
|
|
|
|
|
|
发表于 10-9-2008 08:13 PM
|
显示全部楼层
如要全部解释最后面的[] 里的字怎样用法太长篇了。
在网上找一找吧。就简单的拿上面的例子来解释吧。
L 是带表终止重写的义思。
NC 是比对不分大小写。
RewriteEngine On
RewriteRule ^(.+)/(.+)$ test.php?target=$1&exhibiting=$2 [L,NC]
请回复 |
|
|
|
|
|
|
|
|
|
|
发表于 11-9-2008 09:50 AM
|
显示全部楼层
回复 7# blue333 的帖子
你是说在我的.htaccess file写
RewriteEngine On
RewriteRule ^(.+)/(.+)$ test.php?target=$1&exhibiting=$2 [L,NC]
就可以了??
<?php
switch($target){
case "aboutMifb" :
include("aboutMifb.php");
break;
case "exhibiting" :
include("exhibiting.php");
break;
case "visiting" :
include("visiting.php");
break;
case "businessConference" :
include("conference.php");
break;
case "media" :
include("media.php");
break;
case "usefulInfo" :
include("usefulInfo.php");
break;
case "previousShow" :
include("previousShow.php");
break;
case "contacts" :
include("contact.php");
break;
}
?>
[ 本帖最后由 fenjiao 于 11-9-2008 09:54 AM 编辑 ] |
|
|
|
|
|
|
|
|
|
|
发表于 11-9-2008 10:00 AM
|
显示全部楼层
when index.php?target=visiting
inside got another switch case which is
<td width="200" valign="top">
<table cellspacing="2" cellpadding="5" border="0" width="100%">
<tr>
<td class="submenu"><a href="index.php?target=visiting&task=celebrationHighlights">Celebration Highlights</a></td>
</tr>
<tr>
<td class="submenu"><a href="index.php?target=visiting&task=targetCommunities">Targeted Communities</a></td>
</tr>
<tr>
<td class="submenu"><a href="http://www.trademal.com/events/2009/mifb.reg.php" target="_blank">Visitor Registration</a></td>
</tr>
</table>
</td>
<!-- end sub menu for visiting -->
<td valign="top">
<?php
switch($task){
case "celebrationHighlights" :
include("highlights.php");
break;
case "targetCommunities" :
include("target_communities.php");
break;
default :
include("admission.php");
break;
}
?>
</td>
我要怎样写.htaccess的file 以及<a href=" ">。。
我要写成 $target and oso $target/$task的format... |
|
|
|
|
|
|
|
|
|
|
发表于 11-9-2008 05:00 PM
|
显示全部楼层
看了你的写法如要用 mod_rewrite 会出现一些小问题。不是不能解决但
是又要长片大论,不想。不过无论如何你可以试试以下的写法
你的 link 这样写法
http://yourdomain/visiting
http://yourdomain/visiting/celebrationHighlights
RewriteRule ^(.+)\.php$ - [L,NC]
RewriteRule ^([^/]+)$ index.php?target=$1 [L,NC]
RewriteRule ^([^/]+)/([^/]+)$ index.php?target=$1&task=$2 [L,NC] |
|
|
|
|
|
|
|
|
| |
本周最热论坛帖子
|