james Oduro
james Oduro

Reputation: 673

hide url variables using htaccess

In my application the original file name for "pro" is profile.php and I have used htaccess to write it.

Now I have a URL which looks like this: http://localhost/campuslife/pro?u=mchati.evelyn

for some reasons I want the URL to look like this

http://localhost/campuslife/pro/mchati.evelyn

Please how do i achieve this?

what I tried :

RewriteEngine On
RewriteRule ^pro$ profile.php [L]

Upvotes: 2

Views: 697

Answers (1)

anubhava
anubhava

Reputation: 786359

Inside /campuslife/.htaccess you can use this rule:

RewriteEngine On

RewriteRule ^pro$ profile.php [L,NC]

RewriteRule ^pro/([^/]+)/?$ profile.php?u=$1 [L,NC,QSA]

Upvotes: 2

Related Questions