Forum Moderators: phranque
for eg: htaccess works fine if the query is like this
mysite.com/prog/php
but when the user changes that to
/mysite.com/prog/php 5
ie a space after the php keyword
i want the last value 5 appended to the preceding one as php_5
also if anything other than[a-zA-Z0-9-_] is entered it must then
(1) change the query string such that it only contained the required chars
(2)if cannot be changed redirect to an error page
Can i have to use the REWRITE Cond before the Rewrite Rule for this specified problem
Can anyone have any idea.
Thanks
sgcet
Welcome to WebmasterWorld!
RewriteCond and RewriteRule work together to define the conditions under which the rewrite will occur.
mod_rewrite is not very good for doing complex character substitution, particularly if multiple characters must be substituted in any postition within the URL. Processing in these cases is quite inefficient, and it is often better to rewrite 'problematic' URLs to a PHP or PERL script. The script can then 'fix' the URL, retrieve the requested content, ans serve it.
You might also want to look into mod_speling and content negotiation. Both of these are useful to 'fix' mis-typed URLs.
Jim