开发者

htaccess client index mode rewrite help

I need help for my site for custom domain, let me explain:

I have links:

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 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]

now I have nice URLs: www.mysite.com/CLIENT_INDEX_2/CLIENT_LINK1

One c开发者_运维知识库lient 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

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]

And later get the requested URL in PHP with $_SERVER["REQUEST_URI"].

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜