我在放在我的域名的根htaccess文件下面的代碼:htaccess的改寫 - 包括子域
RewriteRule ^t-shirt-A([^/]+)/([^.]+)$ /tshirt.php?t=t-shirt-A$1 [L,QSA,NC]
我試圖修改它適用即使有一個子域重寫。問題是,htaccess將用於幾個不同的網站,所以子域名和域名可能會有所不同,所以它不能被硬編碼。
例如,我想重寫這些URL
http://www.any_domain_name_here.com/t-shirt-A123456789 http://any_subdomain.another_domain_name_here.com/t-shirt-A987654321
到:
http://www.any_domain_name_here.com/t-shirt.php?t=t-shirt-A123456789 http://any_subdomain.another_domain_name_here.com/t-shirt.php?t=t-shirt-A123456789
也不會工作,如果我使用http://subdomain.mydomain.com/t-shirtA123456789 :(仍只適用於主域根目錄 – libertaire
在你的例子中,你沒有'/ t-shirtA123456789',但我編輯了我的答案。 – anubhava
對不起,這是一個錯字,我的意思是重寫只能在不使用子域名的情況下工作(我的根文件中只有htaccess文件,我無法將其複製到子域名文件夾中) – libertaire