Results 1 to 5 of 5

Thread: Rewrite error on Apache

  1. #1
    Join Date
    Aug 2008
    Beans
    8

    Rewrite error on Apache

    Hi. On the apache server of my Ubuntu, I put this in the httpd.conf :

    Code:
    RewriteCond %{HTTP_USER_AGENT} !.*bot.*
    RewriteRule ^/.*/.*/.*/.*/.*/([a-Z]+)\.([0-9]+)\.html$ \
    http://mywebsite.fr/F?func=find-b&request=$2&find_code=SYS&local_base=$1
    but each time I restart apache, i got that message :

    Syntax error on line 313 of /etc/apache2/apache2.conf:
    RewriteRule: cannot compile regular expression '^/.*/.*/.*/.*/.*/([a-Z]+)\\.([0-9]+)\\.html$'
    Help welcome

  2. #2
    Join Date
    May 2007
    Location
    Phoenix, Arizona USA
    Beans
    2,909
    Distro
    Ubuntu 8.04 Hardy Heron

    Re: Rewrite error on Apache

    Obviously the syntax is wrong in that line. I don't even know what that is supposed to do. Can you tell us? It would be very helpful if we knew what you are trying to accomplish. Did you copy this from a tutorial?

    -Tim
    www.pcchopshop.net

    Hard to find and obsolete PC and server parts. "If we can't find it, it probably doesn't exist"

  3. #3
    Join Date
    Aug 2008
    Beans
    8

    Re: Rewrite error on Apache

    I took the RewriteRule directly from the doc of the developper of my ILS (I'm working in an academic library)

    We're trying to expose our data from our catalog to google, via an Apache server. The rules are used to link the server to the catalog.

  4. #4
    Join Date
    May 2007
    Location
    Phoenix, Arizona USA
    Beans
    2,909
    Distro
    Ubuntu 8.04 Hardy Heron

    Re: Rewrite error on Apache

    OK, well somewhere in that line there is a mistake. You may need to contact the developer and find out what it is. Also, if you typed this in manually, make sure you didn't make an error.

    -Tim
    www.pcchopshop.net

    Hard to find and obsolete PC and server parts. "If we can't find it, it probably doesn't exist"

  5. #5
    Join Date
    Jan 2006
    Location
    United Kingdom
    Beans
    2,787
    Distro
    Kubuntu 6.06 Dapper

    Re: Rewrite error on Apache

    Quote Originally Posted by dbourrion View Post
    Hi. On the apache server of my Ubuntu, I put this in the httpd.conf :

    Code:
    RewriteCond %{HTTP_USER_AGENT} !.*bot.*
    RewriteRule ^/.*/.*/.*/.*/.*/([a-Z]+)\.([0-9]+)\.html$ \
    http://mywebsite.fr/F?func=find-b&re...&local_base=$1
    One immediate problem is that you've got a leading slash - remove it because URIs won't start with a slash when matched against internal rewrite rules (unlike if the code were in .htaccess, which is where this code was probably written for). Confusing, you bet.

    Hence, it should be:

    Code:
    RewriteCond %{HTTP_USER_AGENT} !.*bot.*
    RewriteRule ^.*/.*/.*/.*/.*/([a-Z]+)\.([0-9]+)\.html$ \
    http://mywebsite.fr/F?func=find-b&re...&local_base=$1
    I don't know if that's the cause of the problem, but it won't work anyway until you fix that.

    Also, take the rule out of httpd.conf (nothing should be in there) and put it either in the main config file or the appropriate virtualhost container. That's not the problem here, but it's the right thing to do.

    Mathew
    www.NewtonNet.co.uk - Now supporting IPv6!

    ~ Please don't use PM's to request assistance - post your query on the forum and share the discussion - if you've got a problem chances are you won't be the only one! ~

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •