mod_rewrite - 500 internal server error

Discuss practical ways rearrange URLs using mod_rewrite.

mod_rewrite - 500 internal server error

Postby adma » Thu Sep 25, 2008 12:10 am

Hi!

I´m trying to get dynamic url´s to static with .htaccess without any success.

For example something like :http://www.mydomain.com/cgi-bin/myshop/shop.cgi?action=start&urlpath&artikelname
to
http://www.mydomain.com/cgi-bin/myshop/ ... elname.htm

This is what I have put in my .htaccess.
---------------------------
AddType text/html .shtmlAddHandler server-parsed .shtml
DirectoryIndex index.html index.shtml index.php index.php3 index.htm

RewriteEngine On
RewriteBase /

RewriteCond %{REQUEST_URI} ^(.*)\/(.*?)\.htm$
RewriteRule ^(.*)\/(.*?)\.htm$ /cgi-bin/myshop/shop.cgi?action=start&urlpath=$1&artikelname=$2 [L]
RewriteCond %{REQUEST_URI} ([^\/]*)\.htm$
RewriteRule ([^\/]*)\.htm$ /cgi-bin/myshop/shop.cgi?action=start&artikelname=$1 [L]

RewriteCond %{REQUEST_URI} /(.*)\.shtml$
RewriteRule \/(.*?).html$ /cgi-bin/myshop/shop.cgi?action=search&searchword=$1 [L]
RewriteCond %{REQUEST_URI} /(.*)\.shtml$
RewriteRule (.*).html$ /cgi-bin/myshop/shop.cgi?action=search&searchword=$1 [L]
-----------------------
The response I get is a 500 internal server error. Any help would be much appreciated.

Thanx
adma
 
Posts: 3
Joined: Thu Sep 25, 2008 12:07 am

Postby richardk » Thu Sep 25, 2008 2:06 pm

What does your error log say is causing the 500 error?

Try
Code: Select all
AddType text/html .shtmlAddHandler server-parsed .shtml
DirectoryIndex index.html index.shtml index.php index.php3 index.htm
Options +FollowSymLinks

RewriteEngine On

RewriteRule ^(.+)/([^/]+)\.htm$   /cgi-bin/myshop/shop.cgi?action=start&urlpath=$1&artikelname=$2 [L]
RewriteRule ^([^/]+)\.htm$        /cgi-bin/myshop/shop.cgi?action=start&artikelname=$1            [L]
RewriteRule ^(.+/)?([^/]+)\.html$ /cgi-bin/myshop/shop.cgi?action=search&searchword=$2            [L]
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am

Postby adma » Thu Sep 25, 2008 10:53 pm

Hi!
Thanx for the reply. Unfortunately my host does not allow me to access the error.log only access.log. Is there a possibility to override the apache cofig file with a .htaccess so that I can point the error.log into one of my own log file directories?

richardk wrote:What does your error log say is causing the 500 error?

Try
Code: Select all
AddType text/html .shtmlAddHandler server-parsed .shtml
DirectoryIndex index.html index.shtml index.php index.php3 index.htm
Options +FollowSymLinks

RewriteEngine On

RewriteRule ^(.+)/([^/]+)\.htm$   /cgi-bin/myshop/shop.cgi?action=start&urlpath=$1&artikelname=$2 [L]
RewriteRule ^([^/]+)\.htm$        /cgi-bin/myshop/shop.cgi?action=start&artikelname=$1            [L]
RewriteRule ^(.+/)?([^/]+)\.html$ /cgi-bin/myshop/shop.cgi?action=search&searchword=$2            [L]
adma
 
Posts: 3
Joined: Thu Sep 25, 2008 12:07 am

Postby richardk » Tue Sep 30, 2008 2:27 am

Unfortunately my host does not allow me to access the error.log only access.log. Is there a possibility to override the apache cofig file with a .htaccess so that I can point the error.log into one of my own log file directories?

That is not possible.

What happened when you tried the mod_rewrite i provided?
Try removing the options line.
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am

Postby adma » Thu Oct 02, 2008 1:09 am

richardk wrote:
Unfortunately my host does not allow me to access the error.log only access.log. Is there a possibility to override the apache cofig file with a .htaccess so that I can point the error.log into one of my own log file directories?

That is not possible.

What happened when you tried the mod_rewrite i provided?
Try removing the options line.


It worked
Thanx.
adma
 
Posts: 3
Joined: Thu Sep 25, 2008 12:07 am


Return to Friendly URLs with Mod_Rewrite

Who is online

Users browsing this forum: No registered users and 10 guests

cron