views:

28

answers:

0

I have a website deployed on two hosts: one in the root path the other one in the sub path For example

  • http://one.example.com/xyz => maps to /var/www/
  • http://two.example.com/subpath1/subpath2/ => maps to /var/www/subpath1/subpath2/

Now I want to permanently redirect abc.php to index.php on the hosts

  • http://one.example.com/xyz/abc.php => http://one.example.com/xyz/index.php
  • http://two.example.com/subpath1/subpath2/abc.php => http://two.example.com/subpath1/subpath2/index.php

This is what I have in my .htaccess file but it doesn't work

RewriteEngine On
RewriteRule ^(.*)/abc\.php$ /$1/index.php [NC,L,R=301]

I get it to work for one host but not for the other if I use RewriteBase

RewriteEngine On
RewriteBase /subpath1/subpath2/
RewriteRule ^abc\.php$ index.php [NC,L,R=301]

I would like to use the same .htaccess file on the different hosts.