0

几天前,我发布了一个与此相关的问题,并得到了很大的推动。我也做了一些实验和研究,取得了一些好的结果。这正是我所取得的成就。我把它放在我的文件夹-'文件夹'中的.htaccess中:

RewriteEngine On

#Look for the word "post" and take everything after "post" and store it in $1
RewriteRule   post(.+)$   something.php?file=$1   [L]

# allow public pages
RewriteRule ^index.php$ - [L]
RewriteRule ^style.css$ - [L]
RewriteRule ^bg.png$ - [L]
RewriteRule ^cat_bgg.gif$ - [L]
RewriteRule ^cat_bgr.png$ - [L]
RewriteRule ^h1_bg.gif$ - [L]
RewriteRule ^hd_bg.png$ - [L]
RewriteRule ^menu_bg.png$ - [L]

# serve everyone from specific-domain or specific-user-agent
RewriteCond %{HTTP_REFERER} ^http?://www.abc.com [OR]
RewriteCond %{HTTP_USER_AGENT} ^specific-user-agent$
RewriteRule ^ - [L]

# everybody else receives a forbidden
RewriteRule ^ - [F]

ErrorDocument 403 /index.php

所以这就是它现在的工作方式:我放了一个链接:

www.abc.com

作为

www.xyz.com/folder/post(一些代码)

当有人单击此链接时,根据 .htaccess 'somecode' 被获取并存储在 $1 中并处理:

www.xyz.com/folder/something.php?file=$1

并显示此内容。但是浏览器中显示的网址是:

www.xyz.com/folder/post(somecode)。

现在这就是我想做的。而不是显示:

www.xyz.com/folder/post(一些代码)

我可以展示一些不错的东西吗

www.xyz.com/somethingnice

或者

www.xyz.com/folder/someword

我该怎么做呢?我应该在 RewriteRule post(.+)$ something.php?file=$1 [L]

还是有其他方法?

4

0 回答 0