簡體   English   中英

需要htaccess重定向到子域

[英]Need htaccess redirect for subdomain

我有一個子域qa.test.com,並且在該子域上安裝了codeigniter,但是使用.htaccess中的此規則,我似乎無法擺脫url中的index.php

RewriteEngine On
RewriteCond $1 !^(index\.php|public|user_guide|robots\.txt)
RewriteRule ^(.*)$ /index.php?/$1 [L]

有人可以幫我從子域類型url中刪除index.php。

想通了我沒有啟用mod_rewrite

sudo a2enmod重寫,然后重新啟動Apache

RewriteEngine On
RewriteCond $1 !^(index\.php|public|user_guide|robots\.txt)
RewriteRule ^(.*)$ /index.php?/$1 [L]

這是正確的,盡管您還必須啟用mod rewrite,才能啟用mod rewrite運行此命令

sudo a2enmod rewrite

並且不要忘記重啟apache

sudo service restart apache2

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM