Everything on my page works except that non existing page is recognised as parameter and that displays page with header and footer.
ErrorDocument 404 /error
ErrorDocument 403 /error
ErrorDocument 500 /error
RewriteCond %{SCRIPT_FILENAME} !-d
RewriteCond %{SCRIPT_FILENAME} !-f
RewriteRule ^(.*)$ index.php?v=$1 [L,QSA]
RewriteRule ^(.*)-(.*)-(.*)$ index.php?v=$1&page=$2&folder=$3 [L,QSA]
When I try to open mydomain.com/non-existing-page than "non-existing-page" is recognised as parameter $v and page mydomain.com/index.php$v=non-existing-page is opened with only header footer and no content.
You can change .*
with [^/-]+
to allow only single parameter (non-slash+non-hyphen) to be handled by index.php
.
You can use these rules:
ErrorDocument 404 /error
ErrorDocument 403 /error
ErrorDocument 500 /error
RewriteCond %{SCRIPT_FILENAME} -d [OR]
RewriteCond %{SCRIPT_FILENAME} -f
RewriteRule ^ - [L]
RewriteRule ^([^/]+)-([^/]+)-([^/]+)/?$ index.php?v=$1&page=$2&folder=$3 [L,QSA]
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.