SitePoint Sponsor

User Tag List

Results 1 to 7 of 7
  1. #1
    SitePoint Member
    Join Date
    Jun 2006
    Posts
    6
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Help needed on .htaccess

    I have a website http://www.peoplebeep.com that runs on tomcat.
    When user types http://www.peoplebeep.com i want to redirect to http://www.peoplebeep.com/dialogue/index.php so i have created .htaccess in route directory under public_html dir
    RewriteEngine On
    Options +FollowSymLinks -Multiviews
    #Discussions
    RewriteRule (.*) /dialogue/index.php [QSA,L]
    But when the user clicks on home in index.php page i want to redirect to
    http://www.peoplebeep.com/home.php
    How do i accomblish this.Do i need to write the rule in .htaccess file under /public_html/dialogue dir?
    can any expert guide me

  2. #2
    Twitter: @TimIgoe silver trophy TimIgoe's Avatar
    Join Date
    Feb 2005
    Location
    Blackpool, UK
    Posts
    1,058
    Mentioned
    27 Post(s)
    Tagged
    1 Thread(s)
    Wouldn't it be easier just to have an index.php in the www.peoplebeep.com folder that has a line
    PHP Code:
    header('Location: /dialogue/'); 

  3. #3
    SitePoint Wizard silver trophy
    Join Date
    Mar 2006
    Posts
    6,132
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    you use the term redirect, and your using mod rewrite.

    a redirect will send a location: header to the browsers and cause the address bar to change.
    a rewrite will cause the webserver to interally map the request to a different filename, so the address bar in the browser wil not change to reflect the actual file/url that is processing thier requests.


    so, what is it that you want? a redirect, or a rewrite?



    btw timigoe, while that may seem to be a more straightforward solution, its less efficient. theres no need for the webserver to invoke the php engine just to do a redirect if the webserver can handle this(simple in this case) logic itself.

  4. #4
    SitePoint Member
    Join Date
    Jun 2006
    Posts
    6
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks for the reply.I want rewrite.Please help me solve this issue.

    I have a website http://www.peoplebeep.com that runs on tomcat.
    When user types http://www.peoplebeep.com i want to rewrite to http://www.peoplebeep.com/dialogue/index.php so i have created .htaccess in route directory under public_html dir
    RewriteEngine On
    Options +FollowSymLinks -Multiviews
    #Discussions
    RewriteRule (.*) /dialogue/index.php [QSA,L]
    But when the user clicks on home in index.php page i want to redirect to
    http://www.peoplebeep.com/home.php
    How do i accomblish this.Do i need to write the rule in .htaccess file under /public_html/dialogue dir?
    can any expert guide me

  5. #5
    SitePoint Addict nueva's Avatar
    Join Date
    Apr 2006
    Location
    Uk, London
    Posts
    228
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    whhy don't u use a php file to redirect your website.

  6. #6
    SitePoint Wizard silver trophy
    Join Date
    Mar 2006
    Posts
    6,132
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    put this in your doc root

    Code:
    RewriteEngine On
    Options +FollowSymLinks -Multiviews
    #Discussions
    RewriteRule ^$ /dialogue/index.php [L]
    you dont need a rule for the second scenario.
    just <a href="home.php">
    or even
    <a href="/home.php">

  7. #7
    Certified Ethical Hacker silver trophybronze trophy dklynn's Avatar
    Join Date
    Feb 2002
    Location
    Auckland
    Posts
    14,692
    Mentioned
    20 Post(s)
    Tagged
    3 Thread(s)
    Code:
    # .htaccess in DocumentRoot
    RewriteCond %{REQUEST_URI} !^/?dialogue/
    RewriteRule ^/?(.*)$ dialogue/$1 [L]
    BUT better to change your DocumentRoot to the dialogue subdirectory.

    Regards,

    DK
    David K. Lynn - Data Koncepts is a long-time WebHostingBuzz (US/UK)
    Client and (unpaid) WHB Ambassador
    mod_rewrite Tutorial Article (setup, config, test & write
    mod_rewrite regex w/sample code) and Code Generator


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •