Forum Moderators: phranque
RewriteRule ^([^.]+)/?$ /search.php?l=$1 [L]
which will redirect urls like [mysite...] to [mysite...]
But now the problem I face is that the above rule breaks when there is a dot(.) in the url.
I tried to change the rule to
RewriteRule ^(.+)/?$ /search.php?l=$1 [L]
But is not working and gave me an internal server error.
So can any one help me with the rule so that it also includes url with a dot (.) in them.
Thanks
Sudar
Here dot (.) matches only the literal (.) character and is not matching ‘any character expect the new line character’.
I want all the characters after the domain name to be passed to the query string (even special characters like $,#,^ etc) so I cannot use the rule
RewriteRule ^([A-Z0-9\.\-]+)/?$ /search.php?l=$1 [NC,L]
But anyways thanks for replying.
So [^.]+ means, "one or more characters not equal to a dot/period/full stop."
However, if you want to "allow" dots in the requested URL-path, and you change the rule pattern to this:
RewriteRule ^(.*)$ search.php?l=$1 [L]
This problem can be corrected by adding a RewriteCond -- in this case:
RewriteCond $1 !^search\.php$
RewriteRule (.*) search.php?l=$1 [L]
Jim