...

View Full Version : Hashtag in mod_rewrite function



ItsRicky
04-10-2011, 06:15 AM
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:


RewriteEngine on

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

oesxyl
04-10-2011, 08:00 AM
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:


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

ItsRicky
04-10-2011, 01:43 PM
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.

oesxyl
04-10-2011, 02:41 PM
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:


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



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum