mod_rewrite & query_string

#1
I'm attempting to strip the query string from direct-requests to a specific url schema. Works in Apache, not in LSWS. Any tips?

Code:
# redirect direct requests for post-comment redirect urls
RewriteCond %{QUERY_STRING} ^commented=1
RewriteCond %{HTTP_REFERER} !domain.tld
RewriteCond %{HTTP_REFERER} !sub.domain.tld
RewriteRule ^(.*)$ /$1?  [R=301,L]
 

mistwang

LiteSpeed Staff
#2
Sorry for the late reply, I was on vacation.

Your rewrite rule should work at vhost level, or in .htaccess file if there is no multiple contexts involved.

For example, if you have a vhost with document root at /www/vhost1/html/, and a context "/cgi-bin/"=> "/www/vhost1/html/cgi-bin/", and those rewrite rules is in /www/vhost1/html/.htaccess, it should works except for requests to '/cgi-bin/...", to make it work under "/cgi-bin/", you have to add the same rewrite rule in /www/vhost1/html/cgi-bin/.htaccess

We will modify our .htaccess implementation to make it more compatible with Apache's in next release.
 
Top