#RewriteEngine On
#RewriteCond %{REQUEST_FILENAME} !-d
#RewriteCond %{REQUEST_FILENAME}\.php -f
#RewriteRule ^(.*)$ $1.php
RewriteEngine On
RewriteBase /
# Use the following rule if you want to make the page like a directory
RewriteRule ^user/(!(profile.php))$ user/$1/ [R=301,L]
# The following rule does the rewrite.
RewriteRule ^user/(.+)/$ profile.php?id=$1
# The following rewrite the other way round:
RewriteCond %{REQUEST_URI} ^/profile.php
RewriteCond %{THE_REQUEST} ^(GET|POST|HEAD|TRACE)\ /profile.php
RewriteCond %{QUERY_STRING} id=([^&]+)
RewriteRule ^profile.php$ user/%1?
<files .htaccess>
order allow,deny
deny from all
</files>
RewriteCond %{HTTP_HOST} ^www\.mysite\.com$
RewriteRule ^(.*)$ "http\:\/\/mysite\.com\/$1" [R=301,L]
When I access this URL:
http://mysite.com/user/john/ – This totally works perfectly!
But when I acces the URL without slash at the end, like this: http://mysite.com/user/john browser tells me this error:

What should I do here? Your help would be greatly appreciated and rewarded!
Thanks! 🙂
Your rule here:
Doesn’t seem to be working for me. Try changing it to:
Since your original rule isn’t matching, requests for
http://mysite.com/user/johnis slipping through the rules unchanged and thus not handled by profile.php.