iconic IIRF rewriting all to index.asp

46 Views Asked by At

I am trying to rewrite all to index.asp and the rules that I am using are:

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^.*$ /index.asp [NC,L,QSA]

Now it rewrites all except existing pages, for example if I navigate to /blabla it will rewrite to /index.asp, but if I navigate to /cart.asp it just open cart.asp, is there anything else that I am missing?

Thanks

1

There are 1 best solutions below

0
On BEST ANSWER

I've found the answer by myself:

RewriteRule ^/.*\.html /index.asp [NC,L]
#for any line that does not begin with /index.asp and is an asp page
RewriteRule (?!^/index.asp)(^/.*\.asp) /index.asp [NC,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^.* /index.asp [NC,L,QSA]

first rule is to redirect html to index.asp

second is to redirect all asp pages that are not index.asp to index.asp

third rule is to redirect all that we are missing to index.asp