You are here:  » URL rewrite problem


URL rewrite problem

Submitted by badger on Sat, 2006-07-01 19:26 in

Hi, im having problems switching on URL rewriting. Whenever i switch it on i get the following.

Internal Server Error

Steps i have taken to turn it on.

changed $config_useRewrite = false; to $config_useRewrite = true;

saved htaccess.txt to .htaccess

I have saved .htaccess in the root of my PT instalation.

How do i do the following: ".htaccess per-directory configuration override enabled"

Thanks for your help :)

Submitted by support on Sun, 2006-07-02 07:46

Hi,

To enable .htaccess per-directory configuration override, you need to make sure that "AllowOverride All" is configured within Apache's configuration, either globally, or at least within the VirtualHost container for your site. The appropriate line is:

AllowOverride All

If you don't have access to the Apache configuration for your server (i.e. you're on a shared hosting account) you would need to ask you hosting company to enable it on your account.

The question to ask your host is simply;

"I'd like to use a .htaccess file so that I can use mod_rewrite. I tried creating a .htaccess file but doing so causes an Internal Server Error to be displayed when trying to view any page...."

Hopefully they will be able to set it up so that you can use .htaccess on your account.

Cheers,
David.

Submitted by badger on Mon, 2006-07-03 07:46

Thanks for the quick reply. I have just decided, after putting it off for some time now, to reinstall my system. So i will try this as soon as im back up and running.

Thanks again

Submitted by badger on Tue, 2006-07-04 08:23

Im running this localy for the time being.

I have looked at AllowOverride All in httpd.conf. Is there a way of knowing that it is enabled correctly? There seems to be more than one instance of it. I have tried all of them.

I am running WAMP5. Could this have a different configuration?

thanks

Submitted by support on Tue, 2006-07-04 12:42

Hi,

Are you still getting "Internal Server Error"?

Apache's error log may give more information about the problem - especially if it is to do with permissions.

Have you had mod_rewrite working on this server with other sites? It is unlikely, but possible that mod_rewrite is not compiled into Apache - in which case the error log would indicate this.

I would first get mod_rewrite working on a test site - something that doesn't have such complex rules. For example, if you create a test site, and create the following file test.php in the root directory:

<?php
  
// mod_rewrite test
  
print "You are in directory ".$_GET["dir"];
?>

The associated .htaccess in the same directory should contain:

RewriteEngine On
RewriteBase /
RewriteRule ^(.*)/test.php$ test.php?dir=$1 [L]

Then, if you browse to:

http://test-server/foo/bar/test.php

You should see:

You are in directory foo/bar

Cheers,
David.

Submitted by badger on Wed, 2006-07-05 08:01

beautiful! it was something that im sure i tried before. it works great now thanks.