Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I'm using the below in my .htaccess file.

There 3 types of redirects:

  1. redirect to directory /admin/index.php
  2. redirect to specific .php files e.g. /about
  3. redirect to user profile page from /John

All 3 work on my local environment, but on the server only 1 and 3 works. I'd really appreciate if you can tell me why url redirects of the type '/about' are not working for me.

Many thanks.

<IfModule mod_rewrite.c>

Options -Multiviews
Options +FollowSymLinks
RewriteEngine On

RewriteBase /

RewriteRule ^admin$ /admin/index.php [QSA,L]

RewriteRule ^about/?$ /about.php [NC,L]
RewriteRule ^es/?$ /index.php?lang=2 [NC,L]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([_A-Z0-9a-z-+\.]+)/?$ /public_profile.php?id=$1 [L]

</IfModule>

ErrorDocument 404 /404.php
share|improve this question
1  
Looks good to me, do you have any meaningful errors in the apache logs? You may need to enable rewritelog directive. –  David Houde May 19 '13 at 4:37
    
Yup, trying to get that written in httpd.conf by the server admin. I'll keep this thread updated on my outcome. :) –  Kédar May 19 '13 at 15:18
    
Have you considered actually redirecting the clients instead of rewriting the filenames internally? Depending on what the user shall see, this might be sensible. –  BurninLeo Jul 29 '13 at 12:20

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.