[英]url rewriting using .htaccess?
我正在使用codeigniter。 有一个网址模式: localhost/mysite/application/assets/projects/projectname
该projectname
部分是动态的。 现在,我想将该网址重写为: localhost/mysite/projectname
是否可以使用.htaccess
? 如果是的话,代码是什么。
试试这个.htaccess
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond $1 !^(index\.php|indexcp\.php?|resources|robots\.txt)
RewriteRule ^([A-Za-z0-9_/.-]+)$ index.php?$1
RewriteRule ^(CSI) index.php?/CSI
AddType text/x-component .htc
编辑
一旦尝试这种方式
RewriteRule ^(/application/assets/projects)$ http://localhost/mysite/$1 [R,NC,L]
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.