LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 04-18-2009, 11:29 PM   #1
loserbait
LQ Newbie
 
Registered: Apr 2009
Posts: 4

Rep: Reputation: 0
Rewrites Broken After Server Move


I just moved my website from a server running Apache 2.0 to Apache 2.2. I have a rewrite in my .htaccess which was working prior to the move, but now it doesn't work. Here is the rewrite.

RewriteRule ^\/([A-Za-z]+)\/([A-Za-z0-9]+)\.html$ process\.php?class=$1&action=$2

It doesn't appear to be a problem with the configuration of the server because this rewrite works as expect.

RewriteRule ^test\.html$ test\.php

If anyone has any ideas to share about what might the cause, that would be appreciated. Thanks for reading this.
 
Old 04-19-2009, 08:06 AM   #2
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,163
Blog Entries: 1

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
You don't need to include the starting "/" in your rule, so change it to:
Code:
RewriteRule ^([A-Za-z]+)\/([A-Za-z0-9]+)\.html$ process\.php?class=$1&action=$2
and see if it works.
 
Old 04-19-2009, 07:51 PM   #3
loserbait
LQ Newbie
 
Registered: Apr 2009
Posts: 4

Original Poster
Rep: Reputation: 0
Sorry, the leading slash actually wasn't there. I accidentally pasted one of my other attempts to get it to work. Is there something wrong with the regex? I was told that Apache 2.2 is much more strict in terms of what it will accept for rewrites compared to 2.0
 
Old 04-20-2009, 04:07 AM   #4
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,163
Blog Entries: 1

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
I don't think apache 2.2 is more strict regarding regexes. In fact I've tested your rule with a php file that accepts 2 arguments and it works.
So what is the problem you face? You can take a look at rewrite_log and error_log to see what happens.
 
Old 05-20-2009, 04:10 AM   #5
loserbait
LQ Newbie
 
Registered: Apr 2009
Posts: 4

Original Poster
Rep: Reputation: 0
So I've tried emailing my server admin about getting access to those logs, but they haven't responded so I think I'm on my own for this. One thing I noticed is that if I replace the / with a - in the rewrite condition (and make the corresponding change in the calling url), it works. Do you have an idea of why this is occurring?
 
Old 05-20-2009, 04:53 AM   #6
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,163
Blog Entries: 1

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
How should I know, if you don't post the RewriteCond?
 
Old 05-20-2009, 11:33 AM   #7
loserbait
LQ Newbie
 
Registered: Apr 2009
Posts: 4

Original Poster
Rep: Reputation: 0
It's the same as your first post, just with the / replaced with -.

Code:
RewriteRule ^([A-Za-z]+)-([A-Za-z0-9]+)\.html$ process\.php?class=$1&action=$2
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
how to move files from windows server to linux server by script topsy999 Linux - Newbie 2 01-15-2009 12:40 PM
.Xauthority rewrites itself on logout? Mirkridian Linux - Laptop and Netbook 2 07-07-2007 01:44 PM
What software to move existing mail off a current pop server to my new server lildevil Linux - Software 2 06-01-2006 09:25 AM
erased MEPIS liveCD rewrites itself - ?! joshknape Linux - Newbie 2 01-16-2006 02:56 PM
fstab problem, rewrites at boot renderx Linux - Newbie 2 12-24-2005 02:44 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

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

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration