Web Hosting Talk







View Full Version : [URGENT] Apache Rewrite ::PLEASE HELP::


Mans
05-28-2005, 06:42 AM
I'm writing php script for a magazine. I want visitors to access issues in the following format:

magdomain.com/mm/yyyy/topic

For example: magdomain.com/6/2005/t-34

The .htaccess I came up with looks like the following:

Options +FollowSymLinks
RewriteEngine on
RewriteRule ^(.*)/(.*)/(.*)$ mag.php?d=$1/$2&p=$3

It works except in two cases:
1) The visitor types magdomain.com/6/2005 without backslash after 2005
2) The visitor is not typing issue's date after the domain, e.g. magdomain.com or magdomain.com/ only

Please help me!!! :confused:

TIA

Mans
05-28-2005, 02:24 PM
Any help please?

Thank you.

maxymizer
05-28-2005, 05:05 PM
Options +FollowSymLinks
RewriteEngine on
RewriteRule ^(.*)/(.*)/(.*) mag.php?d=$1/$2&p=$3 [L]

(without $ at the end of the matching-pattern).

And if the visitor doesn't type issue's date, what do you expect to happen? The rule is not matched (and can't be in any sense, how can you determine issue's date if NOTHING has been inputted), so move on th next rule (which probably isn't set).

You might want to refine your regexp, since it will match any string-combination instead of int - int - string combination.