Reputation: 1087
I've been trying this for hours watching online tutorials and stack overflow questions but it doesn't seem to work at all.
I've enabled rewrite on my wamp server.
Example URL:
http://localhost:8081/WEBSITE_URL/page.php?page=about
.htaccess contents:
Options +FollowSymLinks
RewriteEngine On
RewriteCond %{SCRIPT_FILENAME} !-d
RewriteCond %{SCRIPT_FILENAME} !-f
RewriteRule ^([a-z]+)\/?$ $1.php [NC]
RewriteRule ^page/(\w+)$ ./page.php?page=$1
RewriteRule ^page/(\w+)/$ ./page.php?page=$1
Expected URL:
http://localhost:8081/WEBSITE_URL/page/about/
What comes out as result:
Absolutely nothing. No errors, or error logs, just same as no .htaccess.
Could anyone point me in right direction?
Upvotes: 1
Views: 49
Reputation: 784908
Try this:
Options +FollowSymLinks -MultiViews
RewriteEngine On
RewriteBase /WEBSITE_URL/
RewriteCond %{THE_REQUEST} /page\.php\?(page)=([^&\s]+) [NC]
RewriteRule ^ %1/%2/? [R=302,L]
RewriteCond %{THE_REQUEST} /([^/.]+)\.php[\s?] [NC]
RewriteRule ^ %1 [R,L]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^(.+?)/?$ $1.php [L]
RewriteCond %{SCRIPT_FILENAME} !-d
RewriteCond %{SCRIPT_FILENAME} !-f
RewriteRule ^page/(\w+)/?$ page.php?page=$1 [L,QSA,NC]
Upvotes: 1