Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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.

share|improve this question
    
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 Oct 11 '12 at 18:46
    
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. –  nino Oct 12 '12 at 12:34
    
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: 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? –  nino Oct 12 '12 at 12:50
    
I know the .htaccess is somewhat working because if I change the actual page name the error shows this change! –  nino Oct 12 '12 at 12:56
    
Please post the error messages you receive. –  HeatfanJohn Oct 12 '12 at 15:31

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.