htaccess 客户端索引模式重写帮助
我需要有关自定义域的网站的帮助,让我解释一下:
我有链接:
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 代表客户端模板,TEMPLATE_LINK 是模板链接。 我在 htaccess 文件中做了模式重写规则:
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]
现在我有很好的 URL:www.mysite.com/CLIENT_INDEX_2/CLIENT_LINK1
一位客户问我他可以购买域名,链接到我的域名,它将打开他的模板: 例子: 索引为 CLIENT_INDEX_1 的客户购买了:example.com,现在链接看起来:
www.example.com/TEMPLATE_LINK1
www.example.com/TEMPLATE_LINK2
我知道 CLIENT_INDEX 不是文件夹,它只是 GET 变量,但是当有人打开他的链接(www.example.com)时,我如何设置系统将覆盖CLIENT_INDEX 后缀?
谢谢。
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 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
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
也许您可以使用此规则:
然后使用 $_SERVER["REQUEST_URI"] 在 PHP 中获取请求的 URL。
Maybe you could use this rule:
And later get the requested URL in PHP with $_SERVER["REQUEST_URI"].