Reputation: 21
i have created a link like this for access full product when someone click on this link. but its looks a horrible when its alive on the link bar.
my link like this
<a href="ad-view-cproject.php?url=<?php echo $Link; ?>&tsm=<?php echo $Cat;?>">
so what i did is , i made this "ad-view-cproject.php" to "ad" in my .htaccess file .
now my link looks like this
<a href="ad?url=<?php echo $Link; ?>&tsm=<?php echo $Cat;?>">
but when its come live on link bar its like this
http://localhost/cproject/ad?url=J46TKlqSw3Gt4sk&tsm=Education
what i want to do is to replace this url in a url like this .
I want to get rid of = marks and question marks.
Is this posible to do ?
Upvotes: 1
Views: 132
Reputation: 425
you can use .htacces
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule .* - [L]
RewriteRule ^ad/([A-Za-z0-9]+)-([A-Za-z]+)$ index.php?url=$1&tsm=$2 [QSA,L]
regular expression how ([A-Za-z0-9]+)
help you execute wrong symboles
Upvotes: 1
Reputation: 988
You can try with this rewrite rule
RewriteRule ^ad\/([a-zA-Z0-9]+)\/([a-zA-Z0-9]+) /ad?url=$1&tsm=$2
You should also define a regex ruleset for the "code"
Upvotes: 0
Reputation: 2284
Add this to you .htaccess
RewriteRule ^ad/([\w]+)-([\w]+) ad-view-cproject.php?url=$1&tsm=$2
Upvotes: 0