-1

my website URL accept double slashes too. for example when I put https://www.jamalacademy.com/class/9th-class it accept then if i put https://www.jamalacademy.com//class/9th-class or https://www.jamalacademy.com///class/9th-class it accept too.. even if i add so many slashes it accept too..

Help me to get ride of this problem. my current htaccess file is like:

RewriteEngine On

RewriteCond %{THE_REQUEST} \s/+(.*?)/{2,}([^\s]*)
RewriteRule ^ %1/%2 [R=302,L,NE]

RedirectMatch 301 ^(.*)//+(.*)$ https://www.jamalacademy.com/$1/$2

RewriteEngine On
RewriteBase /
Options +FollowSymlinks

RewriteCond %{REQUEST_URI} //+
RewriteRule ^(.*) $1 [R=301,L]

RewriteEngine On
RewriteRule ^class/(.*)/?$ classes_list.php?get_page=$1 [NC,QSA] 

thanks in advance.

RiggsFolly
  • 93,638
  • 21
  • 103
  • 149
Tech Kid
  • 577
  • 2
  • 7
  • 19
  • 1
    Please do not tag spam. This has nothing to do with PHP or HTML. – BugHunterUK Mar 17 '17 at 12:03
  • Possible duplicate of [.htaccess - how to remove repeated characters from url?](http://stackoverflow.com/questions/19439437/htaccess-how-to-remove-repeated-characters-from-url) – Kuldeep Singh Mar 17 '17 at 13:12

1 Answers1

0

You can use it like this:

RewriteEngine On

# remove multiple slashes from URLs
RewriteCond %{THE_REQUEST} //
RewriteRule ^.*$ /$0 [R=301,L,NE]    

RewriteRule ^class/(.*?)/?$ classes_list.php?get_page=$1 [NC,QSA,L]

Make sure to clear your browser cache before testing this change.

anubhava
  • 761,203
  • 64
  • 569
  • 643