Reputation: 754
For the sake of testing purposes I have set up index.php which just contains:
<?php echo var_dump($_GET); ?>
My htaccess looks like this:
RewriteEngine on
#Alternate default index page
DirectoryIndex home.php
# To set your custom php.ini, add the following line to this file:
# suphp_configpath /home/yourusername/path/to/php.ini
# php_value mbstring.func_overload 4 # Required for PWSB support. Please do not uncomment this line.
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^(.*)$ $1.php [L]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.html -f
RewriteRule ^(.*)$ $1.html [L]
RewriteBase /
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^(.*)$ http://%1/$1 [R=301,L]
RewriteCond %{HTTP_HOST} ^motionpicturepicker\.com$ [OR]
RewriteCond %{HTTP_HOST} ^www\.motionpicturepicker\.com$
RewriteRule ^/?$ "http\:\/\/furff\.com" [R=301,L]
which too my knowledge removes .php and .html extensions as well as www.
Now I've tried nearly every example of clean url's google has to offer (around 20 ish) none of which fully work correctly.
Adding this is the closest I've come:
RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s/+index\.php\?film=([^\s&]+) [NC]
RewriteRule ^ index/%1? [R=301,L]
RewriteRule ^index/([^/]+)/?$ index.php?film=$1 [L,QSA]
This makes going to index.php?film=whatever
redirect to /index/whatever
However /index/whatever
return's Error 500 - Internal Server Error
Rather than index.php.
If however I manually change the url to index.php/whatever
it does work but returns an empty array.
So how can I get clean url's to load the page and clean string queries to work as well?
Upvotes: 2
Views: 191
Reputation: 784898
Try these rules:
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^(www\.)?motionpicturepicker\.com$ [NC]
RewriteRule (.*) http://furff.com/$1 [R=301,L]
RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
RewriteRule (.*) http://%1/$1 [R=301,L]
RewriteCond %{THE_REQUEST} \s/+index\.php\?film=([^\s&]+) [NC]
RewriteRule ^ index/%1? [R=301,L]
RewriteRule ^index/([^/]+)/?$ index.php?film=$1 [NC,L,QSA]
RewriteCond %{REQUEST_FILENAME} -d [OR]
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule ^ - [L]
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^(.*)$ $1.php [L]
RewriteCond %{REQUEST_FILENAME}\.html -f
RewriteRule ^(.*)$ $1.html [L]
Upvotes: 2