.htaccess - htaccess redirect remove question mark from url -


i want remove question mark url , redirect same page without question mark.

my url like:

http://domain.com/what-is-your-name?/21.php 

url needed:

http://domain.com/what-is-your-name/21.php 

this remove ? mark url

rewritecond %{query_string} ^(.+)$ rewriterule ^(.*)$ $1%1? [r,l] 

put on first rule in .htaccess

short explanation:

rewritecond %{query_string} ^(.+)$ checks there query string (like ?foobar or ?foo=bar or ?/21.php) in url, fill %1 variable. when rewritecond requirement if fullfiled, rewriterule ^(.*)$ rewrites url. $1 filled url part before ? mark. [r] flag indicates it's redirect. [l] means it's last rule.

i recommend not this, , fixing links.

you can either escape question marks in url's or remove completely.


Comments

Popular posts from this blog

C# random value from dictionary and tuple -

cgi - How do I interpret URLs without extension as files rather than missing directories in nginx? -

.htaccess - htaccess convert request to clean url and add slash at the end of the url -