Go Back   CodingForums.com > :: Server side development > Apache configuration

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 04-10-2011, 05:15 AM   PM User | #1
ItsRicky
New to the CF scene

 
Join Date: Apr 2011
Location: Bermuda
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
ItsRicky is an unknown quantity at this point
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]
ItsRicky is offline   Reply With Quote
Old 04-10-2011, 07:00 AM   PM User | #2
oesxyl
Master Coder


 
Join Date: Dec 2007
Posts: 6,682
Thanks: 436
Thanked 890 Times in 879 Posts
oesxyl is a jewel in the roughoesxyl is a jewel in the roughoesxyl is a jewel in the rough
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
oesxyl is offline   Reply With Quote
Old 04-10-2011, 12:43 PM   PM User | #3
ItsRicky
New to the CF scene

 
Join Date: Apr 2011
Location: Bermuda
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
ItsRicky is an unknown quantity at this point
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.
ItsRicky is offline   Reply With Quote
Old 04-10-2011, 01:41 PM   PM User | #4
oesxyl
Master Coder


 
Join Date: Dec 2007
Posts: 6,682
Thanks: 436
Thanked 890 Times in 879 Posts
oesxyl is a jewel in the roughoesxyl is a jewel in the roughoesxyl is a jewel in the rough
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
oesxyl is offline   Reply With Quote
Reply

Bookmarks

Tags
hashtag, htaccess, mod_rewrite

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 03:09 AM.


Advertisement
Log in to turn off these ads.