Mod_rewrite (specifically RewriteMap)

I have two versions of the website: one is on my laptop with XAMPP installed, and the other is hosted on Freeyellow.

I have a database of images with image ID numbers. Currently my site uses SEO-unfriendly URLs like “?action=galleries&gallery=2”, but I’m trying to use mod_rewrite to use friendlier links, such that the link would replace that with “galleries/sunsets” (for example) while still internally using the parameter code. I understand that the way to do this is using mod_rewrite, with RewriteRule.

I have some of this working fine. However, there is some content that really needs a RewriteMap to work (for example loading an image from a large set of images, using database, with parameters identifying the image ID).

I am completely new to working with files like .htaccess, so it took me a while to realize that the reason I was getting a server error and completely unable to load the site is that you cannot define RewriteMap in .htaccess. It says that you can define it in httpd.conf, which I was able to locate on my localhost version of the site.

However, I am not sure how to do this on my live version hosted on Freeyellow. I could not find the httpd.conf file there, and I think it’s something that’s below root level (as it is in localhost), and therefore I don’t have access to it.

According to this page: https://httpd.apache.org/docs/2.4/rewrite/rewritemap.html
there is one other place I can define a RewriteMap, and that is within a virtualhost context. Unfortunately I have no idea how to do that.

Sponsor our Newsletter | Privacy Policy | Terms of Service