htaccess的客户端索引模式重写帮助 [英] htaccess client index mode rewrite help
问题描述
我需要帮助,我的网站自定义域,让我解释一下:
I need help for my site for custom domain, let me explain:
我有链接:
www.mysite.com/index.php?x=CLIENT_INDEX_1/TEMPLATE_LINK1
www.mysite.com/index.php?x=CLIENT_INDEX_1/TEMPLATE_LINK2
www.mysite.com/index.php?x=CLIENT_INDEX_2/TEMPLATE_LINK1
....
CLIENT_INDEX或TEMPLATE_LINK可以是一切,CLIENT_INDEX重新present客户端模板,TEMPLATE_LINK是模板链接。 我在htaccess文件制作方式重写规则:
CLIENT_INDEX or TEMPLATE_LINK can be everything, CLIENT_INDEX represent client template, TEMPLATE_LINK is template link. and I made mode rewrite rule in htaccess file:
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !=/favicon.ico
RewriteCond $1 !^(index\.php|images|robots\.txt)
RewriteRule ^(.*)$ index.php?x=$1 [L,QSA]
现在我有很好的网址:www.mysite.com/CLIENT_INDEX_2/CLIENT_LINK1
now I have nice URLs: www.mysite.com/CLIENT_INDEX_2/CLIENT_LINK1
一个客户问我他能买域名,链接到我的,它会打开他的模板: 例: 客户端谁指标CLIENT_INDEX_1买:example.com,现在链接如下:
One client ask me can he buy domain, link to mine and it will opening his template: example: client who index is CLIENT_INDEX_1 bought: example.com, now links look:
www.example.com/TEMPLATE_LINK1
www.example.com/TEMPLATE_LINK2
我知道CLIENT_INDEX是不是文件夹,它只是GET变量,但我怎么可以设置当有人打开他的链接(www.example.com),该系统将overwride CLIENT_INDEX后缀?
I know that CLIENT_INDEX is not folder and it is only GET variable, but how can I set when someone open his link (www.example.com) that system will overwride CLIENT_INDEX suffix?
THX。
推荐答案
也许你可以使用这条规则:
Maybe you could use this rule:
RewriteRule ^(.+)$ index.php [L,QSA]
和后来获得请求的URL在PHP中是 $ _ SERVER [REQUEST_URI]
And later get the requested URL in PHP with $_SERVER["REQUEST_URI"].
这篇关于htaccess的客户端索引模式重写帮助的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!