phpurl-rewritingshort-url

Need short URl for my Site htaccess


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.


Solution

  • 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