Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

In CentOS, a2enmod rewrite results in “command not found” but httpd -M lists rewrite module as listed and shared. I'm trying to enable it so can then have these rewrite rule apply so I can switch back to "clean-urls" on my cms. As it stands my site will only load pages that are /?=page instead of /page.

My changes are in /etc/httpd/conf/httpd.conf.

changed NONE to ALL:

<Directory />
Options FollowSymLinks
AllowOverride ALL
</Directory>

Then added the following after

#
# This should be changed to whatever you set DocumentRoot to.
#
<Directory "/var/www/html/mycms">
<IfModule rewrite_module>
RewriteEngine on
RewriteBase /mycms
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
</IfModule>
</Directory>

After restart I get :

Starting httpd: httpd: Syntax error on line 354 of /etc/httpd/conf/httpd.conf: </Directory> without matching <Directory> section
                                                       [FAILED]

edits to settings.php

edits to .htaccess

edits to httpd.conf

edits to mynamed.conf

share|improve this question

closed as off-topic by G-Man, dhag, John WH Smith, Anthon, roaima Aug 24 at 22:41

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions describing a problem that can't be reproduced and seemingly went away on its own (or went away when a typo was fixed) are off-topic as they are unlikely to help future readers." – G-Man, dhag, John WH Smith, Anthon, roaima
If this question can be reworded to fit the rules in the help center, please edit the question.

1 Answer 1

First of all, don't use AllowOverride ALL inside <Directory /> section, but inside the sub-directories where you should want to use .htaccess, such as <Directory "/var/www/html/mycms">

Second, the error message tells you have a problem in the line 354. Can you show the text around that line? You have probably at least one mismatch in your httpd.conf file.

share|improve this answer
    
Ok I am not sure what is going on but I just went in then and was able to enable the clean urls. It is all working now.I think I had made a copy of httpd.conf and had not deleted it plus I found other allowoveride All in it and none of it took effect until deleted copy and restart. Thanks. –  freja Dec 9 '12 at 4:15
    
All above settings depicted in images have worked but they are very messy as far as I'm concerned. –  freja Dec 9 '12 at 4:18

Not the answer you're looking for? Browse other questions tagged or ask your own question.