0

I have configured one of the web-instance configuration files with the below snippet to allow redirects to work through another file without the need to restart the server.

RewriteMap redirects txt:/mnt/var/www/html/abc/content/abc/na/ac/config_en_us/redirects/redirects.txt
RewriteCond %{REQUEST_URI} ^(.*)$
RewriteCond ${redirects:%1} >""
RewriteRule ^(.*)$ ${redirects:%1} [R=301,NC,L]

When trying to restart the httpd after putting the code snippet i am not able to start the apache. The same code is working on other servers. Also the file was created and i have validated the permission.

below is the error statement

Syntax error on line 69 of /etc/httpd/conf.d/abc.conf: RewriteMap: file for map redirects not found:/mnt/var/www/html/abc/content/abc/na/ac/config_en_us/redirects/redirects.txt

I was finally able to bring the server up but the fix was not correct. Here is what i did.

I created the same file with the same name in a the path /etc/httpd/conf.d and then moved it to the required path, after which apache was able to find the file and did come up. Can anyone help me understand what happened.

  • Switch to the user Apache is using and try to do a ls -l on the given path to see what error you get. You need to check the permission of each element in the path, not just for the filename. – Patrick Mevzek May 8 '17 at 20:59
  • 1
    Expanding on what @PatrickMevzek said: the file itself needs read permission for the user Apache runs as, and every directory on the path to that file needs both read and execute permissions – Fox May 9 '17 at 0:47
  • i have tried both of the above suggestions and it did not work, infact i have changed the permission to 77 and it is still not workin. – user1643087 May 9 '17 at 14:45
1

Just to be definitive, this answer is per Fox's comment:

"the file itself needs read permission for the user Apache runs as, and every directory on the path to that file needs both read and execute permissions"


Example. On CentOS, I had the file in /etc/http/conf/ and the paths were not set up as above. I moved it to /var/www/ (which had previously been configured properly) and it then worked.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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