0

This is my .htaccess file's code:

RewriteEngine On    # Turn on the rewriting engine
RewriteRule    ^alluniversitiesview/([^\.]*)\.html$    alluniversitiesview.php?search=$1    [NC,L]    # Handle product
RewriteRule    ^search/([^\.]*)\.html$    index.php?search=$1    [NC,L]    # Handle product
ErrorDocument 404 /search/404.html
ErrorDocument 401 /search/401.html
ErrorDocument 500 /search/500.html
ErrorDocument 403 /search/403.html
ErrorDocument 400 /search/400.html

My requirement: If you go to

http://universitybingo.com/search/HARVARD+UNIV.html
http://universitybingo.com/search/HARVARD+UNI5V!.ER&#37SITY375E.html

Working fine.

But when url contains (%) it does not work like above

EXAMPLE from universitybingo.com

But not working http://universitybingo.com/search/HARVARD+UN%IV.html

Asif Iqbal
  • 1,132
  • 1
  • 10
  • 23

2 Answers2

1

The % is the escape char for URLs.

But as per other answers like htaccess to escape percent (%) from URL or https://www.webmasterworld.com/apache/4220265.htm you can try with the B flag of the mod_rewrite like:

RewriteRule    ^alluniversitiesview/([^\.]*)\.html$    alluniversitiesview.php?search=$1    [NC,L,B]    # Handle product
RewriteRule    ^search/([^\.]*)\.html$    index.php?search=$1    [NC,L,B]    # Handle product
pna
  • 5,651
  • 3
  • 22
  • 37
1

first of check mod rewrite engine is on or not ?

after you can using below html code:

RewriteRule ^alluniversitiesview/([^\.]*)\.html$ alluniversitiesview.php?search=$1    [NC,L,B]    # Handle product
RewriteRule ^search/([^\.]*)\.html$ index.php?search=$1    [NC,L,B]    # Handle product
Ravi Chauhan
  • 1,409
  • 13
  • 26