Reputation: 97
This .htaccess code is giving me trouble for my sub domain mobile.mixtapemonkey.com. When I try to go to a page for the sub domain (ex: mobile.mixtapemonkey.com/page.php) it would send me to my regular domain's 404 page. I'm actually a armature when it comes to .htaccess stuff, so I was hoping if someone can rewrite this so it still rewrite all of my .php extensions off and still allows me to to use my sub domain properly. I'm not as worried about having the sub domain extensions rewrite'd.
also it has this weird thing where it turns "/" into %2F when I post it on facebook, not worried about it but if it's a minor fix I would appreciate it.
Options +FollowSymlinks -MultiViews
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/$ $1 [R=301,L]
RewriteCond %{THE_REQUEST} ^(.*)\.php([#?][^\ ]*)?\ HTTP/
RewriteRule ^(.*)\.php$ $1 [R=301,L]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^(.*)$ $1.php [L]
ErrorDocument 404 http://mixtapemonkey.com/404
Upvotes: 0
Views: 61
Reputation: 841
I don't think your regex for %{THE_REQUEST}
is right.
If you want, you can test it here: http://rubular.com/
I used this and it worked for me:
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_METHOD} !POST
RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s([^.]+)\.php [NC]
RewriteRule ^ %1 [R=301,L]
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^ %{REQUEST_URI}.php [L]
Upvotes: 1