I am using codeigniter. There is a url patern: localhost/mysite/application/assets/projects/projectname
The projectname
part is dynamic. Now I want to rewrite that url to: localhost/mysite/projectname
Is it possible using .htaccess
? If it is what will be the code.
Try this .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
EDIT
Once try this way
RewriteRule ^(/application/assets/projects)$ http://localhost/mysite/$1 [R,NC,L]
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.