LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   mod_rewrite rules stopped working after migration to Debian (https://www.linuxquestions.org/questions/linux-server-73/mod_rewrite-rules-stopped-working-after-migration-to-debian-4175466626/)

quasipickle 06-19-2013 11:20 AM

mod_rewrite rules stopped working after migration to Debian
 
Hi all,

Long time beneficiary, first time poster.

I've built a new Debian server for my PHP development, and migrated all my apps from my old SuSe box. On this new box, some RewriteRule directives are working, others are not. By "not working" I mean I get a 404. I can't see any rhyme or reason why.

Solution:
Turns out Multiviews was responsible for changing the URL before it hit the rewrite rules (see Update) Adding "Options -Multiviews" fixed it.

Working:
Code:

Options +FollowSymLinks

RewriteEngine on
RewriteBase /alure

# Configuring Person properties
RewriteRule ^person/configure/$ index.php?c=person.configure [L]

# Viewing Person pages
RewriteRule ^person/([0-9]*)/$ index.php?c=person&person_id=$1 [L]
RewriteRule ^person/([0-9]*)/(.*)/$ index.php?c=person&person_id=$1&extra=$2 [L]

# Persons list
RewriteRule ^persons/$ index.php?c=persons [L]

Not working:
Code:

Options +FollowSymLinks

RewriteEngine on
RewriteBase /students

# Browsing
RewriteRule ^browse/$ browse.php?page=1 [L]

Both working and not working:
Code:

RewriteEngine on
RewriteBase /eventus

# These 3 work
RewriteRule ^month/([0-9]*)/([0-9]*)/(.*)/(.*)/ schedule.month.php?month=$1&year=$2&category=$3&location=$4 [L]
RewriteRule ^week/([0-9]{4})/([0-9]{2})/([0-9]{2})/(.*)/(.*)/$ schedule.week.php?year=$1&month=$2&day=$3&category=$4&location=$5 [L]
RewriteRule ^day/([0-9]{4})/([0-9]{2})/([0-9]{2})/(.*)/(.*)/$ schedule.day.php?year=$1&month=$2&day=$3&category=$4&location=$5 [L]

# This one doesn't
RewriteRule ^ical/(.*)/(.*)/ ical.php?category=$1&location=$2 [L]

I know mod_rewrite is enabled & working because, well, some .htaccess files are working appropriately. All these .htaccess files have the same access permissions. I know the destination files can be accessed because I can access them directly.

Any ideas?

Update

Turning on the RewriteLog, I saw one line that puzzles me:

Code:

applying pattern '^ical/(.*)/(.*)/' to uri 'ical.php/all/all/'
This appeared when I requested "ical/all/all" - why is ".php" being injected there?

j-ray 06-20-2013 03:48 AM

Hi quasipickle, welcome to LQ and thanks for providing us with the solution!


All times are GMT -5. The time now is 03:30 AM.