简体   繁体   中英

Need htaccess redirect for subdomain

I have a subdomain qa.test.com and codeigniter is installed on that subdomain, however I can't seem to get rid of the index.php in the url with this rule in .htaccess

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

Can someone help me with removing index.php from a subdomain type url.

Figured it out I did not have mod_rewrite enabled

sudo a2enmod rewrite and then restart apache

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

This is correct although you also have to have mod rewrite enabled, to enable mod rewrite run this command

sudo a2enmod rewrite

and don't forget to restart apache

sudo service restart apache2

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM