gprusiiski
gprusiiski

Reputation: 450

.htaccess if request url diffrent from some string than

i have a trivial question about htaccess rewrite condition. The think i want to do in my htaccess is:

When someone accesses my project from a url different from "example.com" to be redirected to a specific controller, for example app_user.php

I need the syntacs for this condition redirect.

Thanks for your time

Upvotes: 1

Views: 2890

Answers (1)

anubhava
anubhava

Reputation: 786091

Try this code in your DOCUMENT_ROOT/.htaccess file:

RewriteEngine On

RewriteCond %{HTTP_HOST} !^example\.com$ [NC]
RewriteCond %{REQUEST_URI} !^/app_user.php
RewriteRule ^ /app_user.php [L]

Upvotes: 3

Related Questions