0

Following is my .htaccess file. It is not working.

RewriteEngine On RewriteBase /

      RewriteCond %{REQUEST_FILENAME} -f [OR]
      RewriteCond %{REQUEST_FILENAME} -d 
      RewriteCond %{REQUEST_FILENAME}\.php -f
      RewriteRule ^ - [L]

      RewriteRule ^friends/([\w-]+)/?$ /friends.php?username=$1 [L,QSA]
      RewriteRule ^followers/([\w-]+)/?$ /followers.php?username=$1 [L,QSA]
      RewriteRule ^settings/([\w-]+)/?$ /settings.php?username=$1 [L,QSA]
      RewriteRule ^messages/([\w-]+)/?$ /chat.php?message_username=$1 [L,QSA]

      RewriteRule ^following/([\w-]+)/?$ /following.php?username=$1 [L,QSA]
      RewriteRule ^following/([\w-]+)/([0-9]+)/?$ /following.php?username=$1&page=$2 [L,QSA]
      RewriteRule ^followers/([\w-]+)/?$ /followers.php?username=$1 [L,QSA]
      RewriteRule ^followers/([\w-]+)/([0-9]+)/?$ /followers.php?username=$1&tpage=$2 [L,QSA]
      RewriteRule ^explore/([\w-]+)/?$ /explore.php?username=$1 [L,QSA]
      RewriteRule ^explore/([\w-]+)/([0-9]+)/?$ /explore.php?username=$1&page=$2 [L,QSA]
      RewriteRule ^photos/([\w-]+)/?$ /userphotos.php?username=$1&page=$2 [L,QSA]

      RewriteRule ^(.*/([a-zA-Z0-9_-]+)|([a-zA-Z0-9_-]+))$ /profile.php?username=$1 [L,QSA]
  • 1
    "It is not working" is never a good enough error description. tell us what you want to happen (sample input and output) and what happens (actual output, error messages, if any). – hoijui Oct 10 '15 at 09:07
  • None of these rules *redirect* anything. They're just for mapping pretty request paths *internally* to scripts. – mario Oct 10 '15 at 09:09
  • http://localhost/script/profile.php?username=myname is not accessed from http://localhost/script/myname . It says NOT FOUND – mukesh phunyal Oct 10 '15 at 09:09

0 Answers0