-3

I want to hide shop if I have bill after that:

These are my sample URLs:

http://mypools.myfiles.com/shop/bill/home.php
http://mypools.myfiles.com/shop/bill/search.php
http://mypools.myfiles.com/shop/bill/index.php

Also, if I type any of the following URLs:

http://mypools.myfiles.com/shop/bill
http://mypools.myfiles.com/shop/bill/

I want it to redirect to the following link:

http://mypools.myfiles.com/shop/bill/home.php
Amal Murali
  • 75,622
  • 18
  • 128
  • 150
  • Why would someone eat your URLs? – hjpotter92 Jun 21 '14 at 16:55
  • There are some ambiguities in your question: Do you want to redirect `http://mypools.myfiles.com/bill/home.php` to `http://mypools.myfiles.com/shop/bill/home.php` (internally) and `http://mypools.myfiles.com/shop/bill` to `http://mypools.myfiles.com/shop/bill/home.php` internally or externally? – Tobias Jun 21 '14 at 17:08
  • Sorry for confusion. Main requirement is to hide "shop" from first three url (should work on all similar urls). if i type "http://mypools.myfiles.com/shop/bill" OR "http://mypools.myfiles.com/shop/bill/" it should redirect to http://mypools.myfiles.com/shop/bill/home.php [ but shop will not display in final url ]. Is it clear now ? – Anoop Ambalapuzha Jun 21 '14 at 17:14

1 Answers1

1

Put this code in your DOCUMENT_ROOT/.htaccess file:

RewriteEngine On

RewriteRule ^(bill/.+)$ /shop/$1 [L,NC]

RewriteRule ^shop/bill/?$ /shop/bill/home.php [L,NC]
anubhava
  • 761,203
  • 64
  • 569
  • 643
  • Above code is for redirecting ....../bill/ to .../bill/home.php OR hide shop folder from uRL? – Anoop Ambalapuzha Jun 22 '14 at 04:16
  • This code is for handling `http://mypools.myfiles.com/shop/search.php` URL in your browser that will be rewritten internally to `http://mypools.myfiles.com/shop/bill/search.php` – anubhava Jun 22 '14 at 04:18