Reputation: 25
So i want to create a URL Friendly with hidden variable, and look like this:
website.dev/en/page/detail.html (work, show the content)
.htaccess file
Options +FollowSymLinks -MultiViews
RewriteEngine on
RewriteBase /
RewriteRule ^([^/]+)/([^/]+)/([^/]+)/(.*)$ index.php?lang=$1&page=$2&detail=$3 [L,QSA,NC]
RewriteRule ^([^/]+)/([^/]+)/(.*)$ index.php?lang=$1&page=$2 [L,QSA,NC]
RewriteRule ^([^/]+)/(.*)$ index.php?lang=$1 [L,QSA,NC]
php file:
$_GET['lang']); // en
$_GET['page']); // page
$_GET['detail']); // detail.html
So, the page return error status 500, but show me the content
https://i.sstatic.net/Qgv5m.png
how i can fix this ?
Upvotes: 2
Views: 2306
Reputation: 785286
You can use:
Options +FollowSymLinks -MultiViews
RewriteEngine on
RewriteBase /
# skip all files and directories from rewrite rules below
RewriteCond %{REQUEST_FILENAME} -d [OR]
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule ^ - [L]
RewriteRule ^([^/]+)/([^/]+)/([^/]+)/(.+)$ index.php?lang=$1&page=$2&detail=$3 [L,QSA]
RewriteRule ^([^/]+)/([^/]+)/(.+)$ index.php?lang=$1&page=$2 [L,QSA]
RewriteRule ^([^/]+)/(.+)$ index.php?lang=$1 [L,QSA]
Upvotes: 1