Asif
Asif

Reputation: 256

Htaccess Forward URL from one to another

I need to forward/redirect a domain from

  http://local.abcxyz.com/be/country/CN/BE

to

http://local.abcxyz.com/be/country/visum-china/BE

How can I do it using .htaccess ?

my current htaccess file looks like this

  RewriteEngine On

    # If the file or directory exists, show it
    RewriteCond %{REQUEST_FILENAME} -f [OR]
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteRule ^(.+) - [PT,L]
    # Blank queries get sent to the index
    #RewriteRule ^$ index.php [L]
    # All other queries get sent to the index as index.php/whatever
    #RewriteRule ^(.*)$ index.php/$1 [L]

    RewriteCond $1 !^(index\.php|images|swf|uploads|js|css|robots\.txt)
    RewriteRule ^(.*)$ /be/index.php/$1 [L]

this htaccess exist in be folder.

Upvotes: 1

Views: 122

Answers (1)

anubhava
anubhava

Reputation: 785611

You can use this code in your DOCUMENT_ROOT/be/.htaccess file:

RewriteEngine On
RewriteBase /be/

RewriteRule ^country/CN/BE/?$ country/visum-china/BE [L,NC]

# If the file or directory exists, show it
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]

RewriteCond $1 !^(index\.php|images|swf|uploads|js|css|robots\.txt)
RewriteRule ^(.+)$ index.php/$1 [L]

Assuming there is no .htaccess in /country/ or any directory below.

Upvotes: 3

Related Questions