【发布时间】:2015-08-02 00:58:26
【问题描述】:
所以基本上我想要的是 Guild Hosting 网站,但我的 htaccess 不再工作了,这就是我想要的:
http://www.example.com/?page=test => http://www.example.com/test
http://www.example.com/?site=testsite => http://testsite.example.com or http://www.testsite.example.com
http://www.example.com/?site=testsite&page=test => http://testsite.example.com/test or http://www.testsite.example.com/test
我打算让 PHP 处理网站是否有 WWW。或者不在使用 MySQL 数据库中的布尔集的网址开头,但现在我只想知道如何设置我的 .htaccess 文件以显示所有这样的站点并可能将它们重定向到正确的站点?这是我当前的.htaccess 文件:
RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\. [OR]
RewriteCond %{HTTP_HOST} ^www\.
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !index\.php
RewriteCond %{HTTP_HOST} ^(.+?)\.dev.randamonium.com$
RewriteRule ^([^/]+)/(.*)$ /index.php?site=%1&site=%2 [L]
<Files .htaccess>
order allow,deny
deny from all
</Files>
Options All -Indexes
我已经尝试寻找与此类似的不同东西,但我找不到特别像我的东西,所以有什么想法吗?
【问题讨论】:
标签: php mysql .htaccess mod-rewrite