Oht
Oht

Reputation: 409

HTACCESS, not on a certain page

I would like to check if a user enters a website via one of the following urls

(en|nl|fr|de|es|pl|sv|it|cs|el|fi|hu)/(home|business|product|contact|faq|gallery|videos|locator)

else, i would like to redirect the user to the 404 page.

i've tried this:

RewriteRule !^((en|nl|fr|de|es|pl|sv|it|cs|el|fi|hu)/(home|business|product|contact|faq|gallery|videos|locator)|404)$ /404 [L,R=307]

but this gives me a routing loop.

Any idea on how to solve this?

Upvotes: 1

Views: 22

Answers (1)

zx81
zx81

Reputation: 41848

Use this:

RewriteCond %{REQUEST_FILENAME} !^404|(?:css|js|jpg|gif|png)$ [NC]
RewriteRule !^(en|nl|fr|de|es|pl|sv|it|cs|el|fi|hu)/(home|business|product|contact|faq|gallery|videos|locator) - [L,R=404]

Upvotes: 1

Related Questions