0

How can I redirect all unknown request to index.html and allow access (redirect) from index.html to other page within same directory.

In my index.html I have submit button , when I click on that It will call perl script , then depends on response the JS will redirect to success page .

So far I tested with these all codes :

#Turn on URL rewriting
RewriteEngine On
# Web Directory
#RewriteBase /
# Protect certain folders from being viewed
#RewriteRule ^(protected|directories) - [F,L]
# Rewrite URLs to index.html/URL
#RewriteRule .* index.html/$0 [PT,L]

RewriteRule ^(.*)$ index.html [L] 

#RedirectMatch permanent ^/(?<!index\.html)(.*) http://192.168.2.32/   
#RewriteEngine on
#RewriteCond %{REQUEST_URI} !^/index.html$
#RewriteRule . index.html [R=302,L]

But I didn't get what am looking for :(

pervez
  • 1
  • 2

1 Answers1

0

Add a rewritecond that tests if a page exists.

RewriteCond ${REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.html [L]

This will work in a .htaccess file or a directory context.

Krist van Besien
  • 1,832
  • 13
  • 16