Questions tagged [rewritemap]

20 questions
5
votes
1 answer

Where is RewriteMap allowed?

This seems like a very simple question. I tried putting a RewriteMap directive in an .htaccess file but the logs showed an alert: RewriteMap not allowed here Then I tried putting it in the VirtualHost declaration in the apache2/sites-available…
lazysoundsystem
  • 195
  • 1
  • 6
3
votes
0 answers

Apache RewriteMap TXT cache - updates don't take

Using a RewriteMap and have it set up with the txt file method - which works fine. Problem is, if I update that txt file - to either alter or add entries - the cache of that file created by httpd doesn't get updated. I don't understand why -…
corner
  • 31
  • 2
2
votes
2 answers

How do I handle a missing RewriteMap file?

I'm defining a RewriteMap in my Apache httpd configuration. (This is working correctly.) RewriteMap redirects-list txt:/path/to/redirects.txt But when the map file (/path/to/redirects.txt) doesn't exist, the server throws an error: RewriteMap:…
Anirvan
  • 401
  • 1
  • 3
  • 13
2
votes
1 answer

RewriteMap inside RewriteCond doesn't work (Apache)

I have a RewriteCond that checks if {QUERY_STRING} contains the right version number, if it doesn't then redirect users to the correct version. For instance if v0.7 is the latest, users accessing http://localhost/?v=0.5 should be redirected to…
James Wong
  • 165
  • 8
1
vote
1 answer

RewriteMap not working, nothing is rewritten (Apache 2.4)

I have a bit of a unique situation: I need to take a subdomain and make it redirect to a random selection of alternate domains, each of which is on a separate server. Think load balancing, except it's technically different from that. Upon…
LukeLC
  • 11
  • 2
1
vote
1 answer

postfix smtp_generic_maps with regular expression

I just started playing around with sender address rewriting with postfix. I run a server with debian-7.11 and postfix-2.9.6. Content of /etc/postfix/main.cf: [...] smtp_generic_maps = hash:/etc/postfix/generic [...] Content of…
Chebarbudo
  • 73
  • 1
  • 6
1
vote
2 answers

RewriteMap problem in .htaccess

I need to redirect URLs of the form subpage.php?sid=123 to named pages. subpagemap.txt exists in the root and contains just the following delimited by Unix line endings \n: 1 a 2 b 3 c The .htaccess is as follows: Options…
1
vote
2 answers

How to whitelist a directory in Apache configuration

In Wordpress, one of the few effective ways at reducing server load is to whitelist individual clients to /wp-login.php and /wp-admin/: order deny,allow deny from all allow from 10.1.1.50 allow from ...other…
1
vote
2 answers

Protecting images from direct access by checking current PHP session with mod_rewrite

I'm working on a solution to a problem where users could potentially access images (in this case PDF files) stored in a folder off the server root. Normally, my application validates users through PHP scripts and sessions. What isn't happening right…
a coder
  • 719
  • 4
  • 20
  • 37
1
vote
0 answers

How to Convert Apache rewritemap from SDBM back to Human-readable Text

I inherited old code where the prior devs had uses a number of large Apache rewritemaps for doing mass redirects. Only problem is they only committed the SDBM-formatted (meaning a .pag and a .dir file) hash files as opposed to the human-readable…
Tad
  • 133
  • 2
  • 11
0
votes
0 answers

Apache URL redirect using RewriteMap

I am struggling with the last part, writing proper RewriteRule (maybe I also need RewriteCond?). I have this mapping.txt: apple 30/products/apple.png xerox 38/products/xerox-300.png dell 3021/products/dell_img.png ... with it I want to do URL…
c0dehunter
  • 271
  • 4
  • 11
0
votes
1 answer

Unable to get RewriteMap to work

I'm trying to use RewriteMap in my virtualhost, but not getting any luck. Here is the content of my virtualhost file, with an entry (line) starting with RewriteMap. From what I read, the file /etc/fixit.php should be executed. But I tested to put a…
aye
  • 229
  • 3
  • 11
0
votes
1 answer

Using RewriteRule to match RewriteMap value and ignore any trailing slash and characters?

I'm trying to use RewriteMap in a apache 2.4 virtualhost .conf file to redirect a number of URLs. A variety of requests can refer to a single entry in the map and I'm having trouble matching these variants in the RewriteRule, particularly trailing…
0
votes
1 answer

Apache Dynamic Virtual Host: RewriteMap: file for map vhost not found

Following the instructions on Apache's site I have added the following to the end of my httpd.conf file: RewriteEngine on RewriteMap lowercase int:tolower #define the map file RewriteMap vhost txt:/web-data/vhost.map # deal with aliases as…
LoneWolfPR
  • 275
  • 1
  • 3
  • 17
0
votes
1 answer

mod_rewrite map doesn't work

I am trying to build a simple mod_rewrite map to have category names translated into ids like so: ../category/electronics -> category.php?cat=1 The map is placed inside the www folder. The code ignores the map as if it doesn't exist This is my…
Yasser
  • 5
  • 4
1
2