mod_rewrite problems in sandbox: Mac OSX 10.6.6 Apache/2.2.15 (Unix) mod_ssl/2.2.15 OpenSSL/0.9.8l DAV/2 PHP/5.3.3

1

greetings earthlings,

I develop sites on a mac and have been trying to get mod_rewrite to work unsuccessfully. I have it working at my hosting provider just fine but really need it local to test/develop.

Mac OSX 10.6.6 Apache/2.2.15 (Unix) mod_ssl/2.2.15 OpenSSL/0.9.8l DAV/2 PHP/5.3.3

I've tried many variations found on the web with no luck.

At this point I'm just trying to get a test directory, named "mod_rewrite," working.

Here's my /etc/apache2/users/me.conf file:

<Directory "/Users/me/Sites/">
    Options Indexes -MultiViews
    AllowOverride None
    Order allow,deny
    Allow from all
</Directory>


<Directory "/Users/me/Sites/mod_rewrite">
     Options All -MultiViews                   
     AllowOverride All
     Order allow,deny
     Allow from all
</Directory>

My .htaccess file in the "mod_rewrite" directory is this:

RewriteEngine on 
RewriteRule ^page/([^/\.]+)/?$ index.php?page=$1 [L] 

Pretty basic for now as a test. As I noted it works fine on my hosting platform.

I restart Apache with each change. Usually there is no change. Sometimes I've broken the whole damn thing. Sometimes I get permission denied for the test directory.

xxx

Posted 2012-10-11T18:16:12.430

Reputation: 11

Is there a reason why you picked the name mod_rewrite for this directory? As mod_rewrite is the name of the Apache module that processes rewrite rules, however you haven't listed any rewrite rules. – HeatfanJohn – 2012-10-11T18:46:34.157

I just used that as a directory name. I could have used anything but wanted it to be, well, obvious. My .htaccess file in the "mod_rewrite" directory is this: RewriteEngine on RewriteRule ^page/([^/.]+)/?$ index.php?page=$1 [L] Pretty basic for now as a test. As I noted it works fine on my hosting platform. – xxx – 2012-10-12T12:34:06.707

For the sake of argument, and since MySQL also get huffy if you use a function name as a variable, I changed the name of the test directory.

Now it's starting to work but I'm getting this error message:

http://localhost/~me/mod_rewrite_test/page/get_me

Not Found

The requested URL /Users/me/Sites/mod_rewrite_test/index.php was not found on this server.

But the index.php file is there?

– xxx – 2012-10-12T12:50:41.447

I know the .htaccess is somewhat working because if I change the actual page name the error shows this change! – xxx – 2012-10-12T12:56:33.433

Please post the error messages you receive. – HeatfanJohn – 2012-10-12T15:31:50.350

please see next question: http://superuser.com/questions/486855/

– xxx – 2012-10-12T20:09:36.943

No answers