Sponsored Content
Top Forums Web Development mod_rewrite RewriteMap - possible to 404? Post 302307811 by sneakyimp on Thursday 16th of April 2009 11:22:10 AM
Old 04-16-2009
mod_rewrite RewriteMap - possible to 404?

In my strenuous efforts to get SEO-friendly urls, I'm using a rewrite map in my apache setup:

Code:
RewriteEngine on
RewriteOptions MaxRedirects=5

RewriteMap seo prg:/Applications/MAMP/htdocs/map.php

#map requests for the original file to the new SEO friendly urls
RewriteCond %{REQUEST_FILENAME} ^/education/db/ug/ug
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME} -f
RewriteCond %{QUERY_STRING} ^(.+)$
RewriteRule ^/education/db/ug/(ug.*)$ ${seo:$1?%1}? [L,R=301]

My rewrite map is a PHP script which checks my database for an id value supplied in the query string and if anything is found, it returns an SEO-friendly text string which i inject into the URL in order to turn a url like this:
Code:
http://mydomain.com/r.php?id=1234

into one like this:
Code:
http://mydomain.com/amazing-and-useful-url/1234

I'm wondering a few things:
1) If an id is not found in my database, can I send a 404 signal from my map program? If so, how?
2) What's the story with RewriteLock. The documentation is rather tightlipped about the need for it. Am I to understand that if I use a PHP script (or any other program) as a rewrite map that I need a RewriteLock file? What are the required permissions on this file? Can I assume that apache needs to read/write it and will maintain anything it might contain?
3) I'm getting quite concerned about a lengthy list of RewriteCond and RewriteRule items in this particular apache conf file. Is there any way to have apache skip the remainder of rules in this conf file if one fails?
4) is PHP a poor choice for this application? If my map daemon crashes, won't part of my site will go dark?
 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

mod_rewrite problem

hi i'm very new to mod_rewrite. I can't seem to have this work. I have a site which has 4 pages : home, links, adverts and contacts page. the adverts page is linked to this url http://www.xxxxxx.com/adverts.php. What i want is that whenever the adverts page is clicked , it will show... (0 Replies)
Discussion started by: arsonist
0 Replies

2. Web Development

mod_rewrite help

Here's my situation. When a user access the site domain.com it redirects to /portal which displays SKIN1 by default. When a user accesses the site domain.com/portal?branding=SKIN1 it displays SKIN1 by default as well. When a user access the site domain.com/portal?branding=SKIN2 it... (0 Replies)
Discussion started by: Adrnalnrsh
0 Replies

3. Web Development

Apache mod_rewrite: from 'friendly' url to actual path

I'd like to translate a friendly url such as: http://www.xxxyyyzzz.com/page/12345678/ to: http://www.xxxyyyzzz.com/page/12/34/56/78/ Seems simple enough, but I cannot figure out how. Any one done this before? (2 Replies)
Discussion started by: markericksen
2 Replies

4. Shell Programming and Scripting

Need help with mod_rewrite rule, redirect

I have to redirect http://www.domain.com/(*)/(*)-hotel-deals.html to http://www.domain.com/(*)/(*)-hotel-deals where of course (*) are dynamic. Any ideas how this could be accomplished? (0 Replies)
Discussion started by: EXT3FSCK
0 Replies

5. Shell Programming and Scripting

help with wget and 404 errors

I am trying to use wget to make a local copy of this website accuscore.com/fantasy-sports/nfl-fantasy-sports/Current-Week-DEF-ST (i have the http:// in front, but the forum will not allow me to put it in at this time) Whenever i try to use wget i receive an "Error 404: Not found". I tried the... (4 Replies)
Discussion started by: problemss
4 Replies

6. Web Development

Mod_rewrite http to https

Hi Team, I have a question on the apache mod_rewrite module. I have a requirement of rewriting only specific url's to https. Requirement below:- want to match a word (test) on the url and if matches then it should rewrite to https. example:- ... (1 Reply)
Discussion started by: arumon
1 Replies

7. UNIX for Advanced & Expert Users

Apache Mod_rewrite Mystery

Hi Folks, I am running on a CentOS 6.3 server, whose primary function until recently has been my Zimbra mail server exclusively. I added wordpress and I have not been disappointed, with this one exception of Apache mod_rewrite. I have already tried to set selinux to permisive to eliminate that... (5 Replies)
Discussion started by: cjm51213
5 Replies

8. Web Development

Mod_rewrite - URL rewrite based upon HTTP_REFERER

Hello, I have added following rewrite cond and rewrite rules but it does not work. RewriteCond %{HTTP_REFERER} ^http://192\.168\.1\.150/categories/.*$ RewriteRule ^(.*)$ http://www.blahblah.com/ When I hit url : http://192.168.1.150/categories/881-Goes?page=7 in my browser - it... (2 Replies)
Discussion started by: ashokvpp
2 Replies

9. Web Development

Mod_rewrite to handle paths ?

I hope someone can help. I somewhat know what a mod_rewrite does which is URL rewiring. What I don't know is how to make the mod_rewrite to handle paths ? Can this be why an AngularJS file is not being loaded ? (36 Replies)
Discussion started by: MaxtheCat
36 Replies
map::slippy::fetcher(n) 					 Mapping utilities					   map::slippy::fetcher(n)

__________________________________________________________________________________________________________________________________________________

NAME
map::slippy::fetcher - Accessing a server providing tiles for slippy-based maps SYNOPSIS
package require Tcl 8.4 package require Tk 8.4 package require img::png package require map::slippy package require map::slippy::fetcher ?0.2? ::map::slippy::fetcher fetcherName levels url fetcherName levels fetcherName tileheight fetcherName tilewidth fetcherName get tile donecmd _________________________________________________________________ DESCRIPTION
This package provides a class for accessing http servers providing tiles for slippy-based maps. API
::map::slippy::fetcher fetcherName levels url Creates the fetcher fetcherName and configures it with the number of zoom levels supported by the tile server, and the url it is listening on for tile requests. The result of the command is fetcherName. METHODS fetcherName levels This method returns the number of zoom levels supported by the fetcher object, and the tile server it is accessing. fetcherName tileheight This method returns the height of tiles served, in pixels. fetcherName tilewidth This method returns the width of tiles served, in pixels. fetcherName get tile donecmd This is the main method of the fetcher, retrieving the image for the specified tile. The tile identifier is a list containing three elements, the zoom level, row, and column number of the tile, in this order. The command refix donecmd will be invoked when the fetcher either knows the image for the tile or that no image will forthcoming. It will be invoked with either 2 or 3 arguments, i.e. [1] The string set, the tile, and the image. [2] The string unset, and the tile. These two possibilities are used to either signal the image for the tile, or that the tile has no image defined for it. REFERENCES
[1] http://wiki.openstreetmap.org/wiki/Main_Page KEYWORDS
http, location, map, server, slippy, tile, url, zoom map 0.2 map::slippy::fetcher(n)
All times are GMT -4. The time now is 09:35 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy