top button
Flag Notify
    Connect to us
      Facebook Login
      Site Registration Why to Join

Facebook Login
Site Registration

Apache: mod_rewrite url has pound (#) symbol

+2 votes
198 views

My url has # in the url. Could some one suggest how to use this to redirect. I do not have control over how the url is being generated as its a software product. The below rule does not seem to work.

RewriteRule ^(/share/page/repository#)$ /share/page/context/mine/myfiles [B,R]

I tried to escape the hash with [^c], but it does not seem to work..Any clues on how to handle " # "

posted Jan 19, 2014 by Garima Jain

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

+1 vote

The part of the URL after the # is not sent to the server, so it is not possible to match on it. Anyway, if you just remove it from your pattern, you should get the same result since you do not appear to be trying to match on anything after it.

answer Jan 20, 2014 by Amit Parthsarthi
Similar Questions
+2 votes

I setup an apache server a while back without a virtualhost and got everything working fine. I added a virtualhost and it seems to work fine on desktops, but on our phones (an iphone and a windows phone), both redirect to my root site if the user adds www to the domain in the address bar.

I assume its just some mistake in my virtualhost setup, but I dont understand why it works on desktop but not mobile. I added a ServerAlias to include the www prefix onto the domain and restarted apache, but it doesnt seem to make a difference. I always get the "root" (hope Im using the right naming convention) host back.

0 votes

I am a bit confused about the mod_rewrite documentation. It shows this rule to block hotlinking:

RewriteCond "%{HTTP_REFERER}" "!^$"
RewriteCond "%{HTTP_REFERER}" "!www.example.com" [NC]
RewriteRule ".(gif|jpg|png)$" "-" [F,NC]

however, I'd think a better rule would be:

RewriteCond "%{HTTP_REFERER}" "^$" [OR]
RewriteCond "%{HTTP_REFERER}" "!(www.)?example.com/.*$" [OR,NC]
RewriteRule ".(gif|jpg|png)$" "-" [F,NC]

if I want to block anyone manually typing in a link (no referer) + hotlinking (probably has a referer). Do i need the [OR] on the 1st
RewriteCond and not the 2nd one? It seems to work with OR on both conditions.

+1 vote

I have Apache SSL virtuals behind the Nginx proxy defined with this directive:

SetEnvIf X-Forwarded-Proto https HTTPS=on

Users often use the following rewrite rule in their htaccess files for detecting SSL connection, but the variable HTTPS is not treated as expected:

RewriteCond %{HTTPS} =on

Is there any workaround for this? So far, I tried to disable mod_ssl completely and also checked modules hooks and it seems that environment files are loaded before the rewrite module.

+2 votes

Please tell us about the apache settings so that we can set the Proxytimeout to "each URL"?

example
URL1:
timeout = 60

URL2:
timeout = 300

0 votes

While clicking on the image it opens into the browser. I dont want to allow client to open the image in browser as separate url. I have blocked the /image/ directory from access/listing , but the image is opening.

How to stop that in apache. Please help me.

Contact Us
+91 9880187415
sales@queryhome.net
support@queryhome.net
#280, 3rd floor, 5th Main
6th Sector, HSR Layout
Bangalore-560102
Karnataka INDIA.
QUERY HOME
...