This forum has been moved here:
Helicon Tech Community Forum

ISAPI_Rewrite 3.0 (Forum Locked Forum Locked)
 Helicon Tech : ISAPI_Rewrite 3.0
Subject Topic: How the redirect to start page
Message |

Joined: 26 November 2009
Posts: 47
Posted: 07 December 2011 at 10:42am

Here is my sample .htaccess file.

RewriteMap map txt:mapping.txt
RewriteMap lower int:tolower

RewriteCond %{HTTP:Host} ^(?:www\.)?example\.com$
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{QUERY_STRING} (?!admin)
RewriteCond ${map:${lower:$1}|NOT_FOUND} !NOT_FOUND
RewriteRule ^(.*?\.(?:html|gif|jpg|png)) ${map:${lower:$1}} [NC,L,NS,QSA]

and what i need is that if a .html file does not in mapping file exists then we should be redirected to start page.
Back to Top

Joined: 01 October 2003
Online Status: Online
Posts: -160
Posted: 12 December 2011 at 4:27am

try to put the following rule on top of the existing rule:

RewriteCond ${map:${lower:$1}|NOT_FOUND} NOT_FOUND
RewriteRule ^(.*?\.(?:html|gif|jpg|png)) /? [NC,R=301,L]

So if the entry is not there, than redirect to root.

Back to Top

Sorry, you can NOT post a reply.
This forum has been locked by a forum administrator.

Printable version Printable version