Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New Coder
    Join Date
    Sep 2007
    Location
    India
    Posts
    72
    Thanks
    1
    Thanked 2 Times in 2 Posts

    URL rewriting problem..

    Hi dears,

    My website need a new page for the URL www.hostname.com#277.
    ie, when users visiting this URL, it should see some page other than my home page (index.php)...

    I tried URL redirect through htacess with following conditions..but I didn't get a solution for this..

    I tried
    1. RewriteRule ^#277 /new_page.php

    2. RewriteRule ^index.php#277 /new_page.php

    but it seems not working this line of code ..

    Please anyone can help me.. Also, is there any other solution than URL rewriting to display the new page when visiting www.hostname.com#277 ?

    Regards
    Nissar
    - Developer from India

    Firefox 2.0

  • #2
    Super Moderator Inigoesdr's Avatar
    Join Date
    Mar 2007
    Location
    Florida, USA
    Posts
    3,647
    Thanks
    2
    Thanked 406 Times in 398 Posts
    You can't use the pound sign(#) in a URL rewrite because it's never sent to the server. It's used by the browser to point to anchors. Most sites use pseudo-directories for their rewrites: url.com/page/id/name etc.

  • #3
    New Coder
    Join Date
    Dec 2007
    Posts
    96
    Thanks
    8
    Thanked 1 Time in 1 Post
    actually there is another command in .htaccess file wich let you to define the home page
    ie,
    PHP Code:
    DirectoryIndex YOURHOMEPAGE.php  index.php index.html 
    note that this applied to all directories under this folder so its better to add another choice if YOURHOMEPAGE.php is not exist, otherwise it will display "Page not found" error (the other choice's here in the example are index.php and index.html)

  • #4
    New Coder
    Join Date
    Sep 2007
    Location
    India
    Posts
    72
    Thanks
    1
    Thanked 2 Times in 2 Posts
    Quote Originally Posted by skmd View Post
    actually there is another command in .htaccess file wich let you to define the home page
    ie,
    PHP Code:
    DirectoryIndex YOURHOMEPAGE.php  index.php index.html 
    note that this applied to all directories under this folder so its better to add another choice if YOURHOMEPAGE.php is not exist, otherwise it will display "Page not found" error (the other choice's here in the example are index.php and index.html)
    Thank you for the help..

    But my requirement is slightly different.. I need to display a different page only when the URL is www.hostname.com#277. and when the url is www.hostname.com I should see www.hostname.com/index.php..

    Please can you give me a suggestion for this?
    Thank you in advance
    - Developer from India

    Firefox 2.0


  •  

    Posting Permissions

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