ZK,

Originally Posted by
M.Zeb Khan
Output: search.php?output=nice&query=sitepoint.com
I have the following in my htaccess but the problem is, its not passing the dots:
If you're not passing the dot character, add it to the character range, i.e., [a-zA-Z0-9] => [a-zA-Z0-9.]
Think about that, though, 'cause that will also match search.php (it's ALMOST as bad as using (.*)!) and cause a loop. What's the difference? The extension that you're willing to accept.
There are three ways to correct this problem:
1. Add a "marker" to the link which will then designate that it's to be redirected to search.php, i.e.,
Code:
RewriteRule ^link-to-([a-zA-Z0-9.]+)$ search.php?output=nice&query=$1 [L]
2. Specify the domain extensions that you will accept: .com, .org, .whatever, i.e.,
Code:
RewriteCond %{REQUEST_URI} (\.com|\.org|\.whatever)$
RewriteRule ^([a-zA-Z0-9.]+)$ search.php?output=nice&query=$1 [L]
3. Specify the file extensions that you will NOT redirect to search.php: .php, .js, .css, i.e.,
Code:
RewriteCond %{REQUEST_URI} !(\.php|\.js|\.css)$
RewriteRule ^([a-zA-Z0-9.]+)$ search.php?output=nice&query=$1 [L]
It's all in specifying your requirements for the mod_rewrite statements.
Regards,
DK
Bookmarks