Link to home
Start Free TrialLog in
Avatar of Imaginx
Imaginx

asked on

Can't get .htaccess to work on Rackspace server.

On the server,
in /etc/apache2/apache2.conf -> looks similar to httpd.conf.
in /etc/apache2/httpd.conf -> empty.

I can't get .htaccess to work for a clients wordpress site to navigate correctly.

Htaccess ->
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

Please help Experts!
TIA -Steve
Avatar of Jason C. Levine
Jason C. Levine
Flag of United States of America image

Can you get any rewrite statement to work?  Wondering if Mod Rewrite is not enabled...
Avatar of Imaginx
Imaginx

ASKER

I don't believe so. I can't get htaccess to work at all. Not even w/ password protected directories.
Sorry, re-reading the initial post.  httpd.conf is empty?
Avatar of Imaginx

ASKER

Yep, empty. I've read online where that's a normal setup. httpd.conf is then used for user-specific configurations. However- I've never experienced that. I've always had a httpd.conf file as normal.
Try adding:

AllowOverride ALL

to the httpd.conf file and restart Apache
Avatar of Imaginx

ASKER

No dice.

Also tried different combinations of the following, after that test, including:

LoadModule rewrite_module modules/mod_rewrite.so

<Directory />
Options FollowSymLinks
Write failed: Broken pipe
Stevens-MacBook-Pro:~ admin$
Deny from all
Satisfy all
</Directory>
Avatar of Imaginx

ASKER

Sorry: combinations of the following:

LoadModule rewrite_module modules/mod_rewrite.so

<Directory />
Options FollowSymLinks
AllowOverride All
Order deny,allow
Deny from all
Satisfy all
</Directory>
did you restart your server after you added the allowoverride directive ?
Avatar of Imaginx

ASKER

restarted apache after all changes
Avatar of Imaginx

ASKER

Jason1178,

Found this:
http://stackoverflow.com/questions/9021425/how-to-check-if-mod-rewrite-is-enabled-in-php

Mod rewrite IS NOT enabled. You were right to ask.
easier way, just remove those ifmodule lines if mod rewrite is mandatory for your site to work.

you'll get a 550 error on the web side, and an explicit error string in apache's error log
Avatar of Imaginx

ASKER

Skull,

Are you talking about the lines to check if mod_rewrite is enabled ?
That was just a test.

The app is just a wordpress site, which creates the htaccess for you.

I'm working to get the server to recognize & interpret the htaccess
Avatar of Imaginx

ASKER

Just Changed:
LoadModule rewrite_module modules/mod_rewrite.so

<Directory />
Options FollowSymLinks
AllowOverride All
Order deny,allow
Deny from all
Satisfy all
</Directory>

To:
LoadModule rewrite_module modules/mod_rewrite.so

<Directory /var/www/default>
Options FollowSymLinks
AllowOverride All
RewriteEngine On
Order deny,allow
Deny from all
Satisfy all
</Directory>

- nothing happens in the root directory, where the htaccess is the wordpress created file.

- if top line is
<Directory /var/www/default/test>
and you go to the test directory, it tells me that i dont have the permission to access mod_rewrite.php (the test file i made)

So it seems partially affective in the test directory. However, the test directory never prompts me for the directory username / password thats in the htaccess.
ASKER CERTIFIED SOLUTION
Avatar of Imaginx
Imaginx

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Yeah, that would do it, good catch.  Eventually we would have ended up mucking about in the various .conf files until a setting was fixed...
Avatar of Imaginx

ASKER

I agree Jason - there's only so many places the directives can be !

Nothing better than getting some back burner problems off your desk :)

Thanks again everyone.

Are you talking about the lines to check if mod_rewrite is enabled ?
That was just a test.

yes. by removing such lines you can clearly determine wether the problem is that mod_rewrite is not enabled or the .htaccess is not parsed. you can also voluntarily write a faulty directive to make sure.

in your case, the problem was the missing "AllowOverride All" in the proper directory (ie /var/www). setting it in / was useless because the best matching directory wins meaning that if your script is in /var/www/stuff, the settings for /var/www have a higher precedence than the settings in /. note that it is best not to toy with the / settings for security-reasons
Avatar of Imaginx

ASKER

Probably not a good example of a 'global' fix, just what worked perfect in my environment.