Denis Pavlovic Denis Pavlovic - 6 months ago 21
PHP Question

htaccess resulting in 500 internal error

RewriteBase /www/

RewriteEngine On

RewriteRule ^([a-zA-Z0-9_-]+)$profile.php?u=$1

RewriteRule ^([a-zA-Z0-9_-]+)/$profile.php?u=$1

RewriteRule ^albums/([a-zA-Z0-9_-]+)$view_albums.php?u=$1

RewriteRule ^albums/view_photo/([a-zA-Z0-9_-]+)$view_photo.php?uid=$1

Answer

Try this code

<IfModule mod_rewrite.c>
  RewriteBase /www/
  RewriteEngine On

  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d

  RewriteRule ^([a-zA-Z0-9_-]+)$  profile.php?u=$1 [L]
  RewriteRule ^([a-zA-Z0-9_-]+)/$ profile.php?u=$1 [L]
  RewriteRule ^albums/([a-zA-Z0-9_-]+)$  view_albums.php?u=$1 [L]
  RewriteRule ^albums/view_photo/([a-zA-Z0-9_-]+)$  view_photo.php?uid=$1 [L]
</ifModule>