Reputation: 99
I need to change
http://localhost/engineering/management/administrator/modules/course/view.php
to
http://localhost/engineering/course_view.php
I tried the following rewriting
Options +FollowSymlinks
RewriteEngine on
RewriteRule ^engineering/([.*])_([.*])\.php$ /engineering/management/administrator/modules/$1/$2.php
But it does not affect the url. I think the code has some problem.
Upvotes: 1
Views: 376
Reputation: 363
Here we go:
Options +FollowSymlinks
RewriteEngine on
RewriteRule ^(.*)_(.*)\.php$ management/administrator/modules/course/view.php
Since you are in localhost and inside the folder engineering, you can omit that in rule. This works only if you place the .htaccess inside the engineering folder.
http://localhost/engineering/course_view.php
Thanks,
Najeem
Upvotes: 1
Reputation: 1090
Just delete '[' ']' from your rule.
RewriteRule ^/engineering/(.*)_(.*)\.php$ /engineering/management/administrator/modules/$1/$2.php
UPD Added '/' at the beginnig of replace pattern.
P.S. Sorry, I can't check this rule myself. Haven't apache installed on my pc.
Upvotes: 1