how to set redirect

1 view
Skip to first unread message

amit

unread,
Sep 7, 2011, 5:09:24 AM9/7/11
to phpcamp
Hello friends,

I have webpage located at http://www.example.com/home and i want to
set it to
http://www.example.com/, in short i want to remove "home" directory
from url.

How can i remove it using .htaccess ? i gone through few tutorials but
no luck yet.


Thanks and Regards
Amit Patil

amit

unread,
Sep 7, 2011, 5:39:28 AM9/7/11
to phpcamp
I think i need to add more details so it shouldnt be misleading
actually i dont want to set redirect i just want to HIDE the "home"
directory

so when i see www.example.com/index.php it will be actually
www.example.com/home/index.php

because i have all my files in home directory i just dont want to show
"home" in URL


I hope i m much clear now.

On Sep 7, 2:09 pm, amit <amitpatil...@gmail.com> wrote:
> Hello friends,
>
>    I have webpage located athttp://www.example.com/homeand i want to
> set it tohttp://www.example.com/, in short i want to remove "home" directory

Praveen Kumar

unread,
Sep 7, 2011, 7:24:57 AM9/7/11
to php...@googlegroups.com
Amit,

If mod_rewrite is enabled, you can try this

RewriteEngine On
RewriteBase   /
RewriteRule   index.php home/index.php


Since I don't know regular expressions, I gave a simple example which works for only 1 file i.e. index.php.

Amit Patil

unread,
Sep 7, 2011, 11:51:03 PM9/7/11
to php...@googlegroups.com
Hello friends,

 Thanks for help....I got the solution

This one did the trick

RewriteRule ^tab3/(.*)$ tab.com/$1 [R=301,L]
RewriteRule (.*)  /tab3/$1

Thanks and Regards,
Amit Patil
www.amitpatil.me


On Thu, Sep 8, 2011 at 8:32 AM, Amit Patil <amitpa...@gmail.com> wrote:
Thanks Praveen for the help,

RewriteRule ^(.*)$ tab3/$1  [L,QSA]

This one worked for me, but it works only if i enter something after /

Works 1) www.example.xom/abc
           2) www.example.com/anything

Doesn works : 1) www.example.com




 

--
On Twitter ==> http://twitter.com/phpcamp
On Facebook ==> http://www.facebook.com/campersfanpage
 
 
 
You received this message because you are subscribed to the Google
Groups "phpcamp" group.
To post to this group, send email to php...@googlegroups.com



--
Thanks and Regards,
Amit Patil
http://www.amitpatil.me






--
Thanks and Regards,
Amit Patil
http://www.amitpatil.me



Amit Patil

unread,
Sep 7, 2011, 11:02:17 PM9/7/11
to php...@googlegroups.com
Thanks Praveen for the help,

RewriteRule ^(.*)$ tab3/$1  [L,QSA]

This one worked for me, but it works only if i enter something after /

Works 1) www.example.xom/abc
           2) www.example.com/anything

Doesn works : 1) www.example.com



 
On Wed, Sep 7, 2011 at 4:54 PM, Praveen Kumar <apn...@gmail.com> wrote:

--
On Twitter ==> http://twitter.com/phpcamp
On Facebook ==> http://www.facebook.com/campersfanpage
 
 
 
You received this message because you are subscribed to the Google
Groups "phpcamp" group.
To post to this group, send email to php...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages