Reputation: 423
I'm trying to prevent a "messy" URL for people to see, when they hover over the link. Like this one:
http://screensnapr.com/v/4z84A3.png
Now, I have it in the .htaccess as this:
RewriteEngine On
RewriteRule ^forms/([0-9]+).*/?$ _lib/forms/report.php?id=$1 [L,QSA]
but apparently I'm doing something wrong. This is my link:
<a style="float: right;padding-right: 15px; color: #3BC3C0;" href="../../_lib/forms/report.php?id=<?php echo $row['id'] ?>" rel="facebox"><img src="../../_lib/images/notice.png"></a>
Do you guys happen to know what I'm doing wrong?
Upvotes: 0
Views: 148
Reputation: 15044
RewriteRule forms/(\d+)/.*$ /foldername/foldername/_lib/forms/report.php?id=$1
HTML
<a style="float: right;padding-right: 15px; color: #3BC3C0;" href="/foldername/foldername/_lib/forms/report.php?id=<?php echo $row['id'] ?>" rel="facebox"><img src="/foldername/foldername/_lib/images/notice.png"></a>
You need to use absolute urls for your links so don't use ../../_lib/forms use /foldername/foldername/_lib/forms/ then update the path portion in the rewrite rule I have with that path as well.
Upvotes: 1
Reputation: 1862
Try this:
RewriteRule ^forms/([0-9]\d*)/.*$ /_lib/forms/report.php?id=$1
This is assuming your _lib directory is in the Document Root of the website. It's better to provide an explicit path to the PHP file from the Document Root.
Upvotes: 0