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 to the CF scene
    Join Date
    Apr 2011
    Location
    Bermuda
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Hashtag in mod_rewrite function

    So I'm trying to redirect mysite.com to mysite.com/#home and the mod_rewrite code that im using is turning #home into %23home. Is there any way to change it to redirect to #home and not %23home?

    Here's my .htaccess code:

    Code:
    RewriteEngine on
    
    RewriteCond %{HTTP_HOST} ^mysite.com$ [OR]
    RewriteCond %{HTTP_HOST} ^www.mysite.com$
    RewriteRule ^/?$ "http\:\/\/mysite\.com\/\#home" [R=301,L]

  • #2
    Master Coder
    Join Date
    Dec 2007
    Posts
    6,682
    Thanks
    436
    Thanked 890 Times in 879 Posts
    Quote Originally Posted by ItsRicky View Post
    So I'm trying to redirect mysite.com to mysite.com/#home and the mod_rewrite code that im using is turning #home into %23home. Is there any way to change it to redirect to #home and not %23home?

    Here's my .htaccess code:

    Code:
    RewriteEngine on
    
    RewriteCond %{HTTP_HOST} ^mysite.com$ [OR]
    RewriteCond %{HTTP_HOST} ^www.mysite.com$
    RewriteRule ^/?$ "http\:\/\/mysite\.com\/\#home" [R=301,L]
    do you have a file in the document root with name #home or what do you want to do using this? what is after # is part of the %{QUERY_STRING}.

    best regards

  • #3
    New to the CF scene
    Join Date
    Apr 2011
    Location
    Bermuda
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by oesxyl View Post
    do you have a file in the document root with name #home or what do you want to do using this? what is after # is part of the %{QUERY_STRING}.

    best regards
    I'm using an ajax hashtag loader, so different hashtags load different content into the main content area, without a hashtag its blank, so I would like it to display #home when someone accesses the domain directly.

  • #4
    Master Coder
    Join Date
    Dec 2007
    Posts
    6,682
    Thanks
    436
    Thanked 890 Times in 879 Posts
    Quote Originally Posted by ItsRicky View Post
    I'm using an ajax hashtag loader, so different hashtags load different content into the main content area, without a hashtag its blank, so I would like it to display #home when someone accesses the domain directly.
    try this:
    Code:
    RewriteRule ^(.*)$  yourhashtagloader?$1 [L]
    and try to change ?$1 according with what the hashtag loader expect.
    In case doesn't work, try to use the PT flag.
    also try %{QUERY_STRING} or %{REQUEST_URI}

    http://httpd.apache.org/docs/2.2/rewrite/remapping.html

    best regards


  •  

    Tags for this Thread

    Posting Permissions

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