I am trying to clean my URLs but everything I've tried so far seems to completely give me an 500 internal server error.
What I am trying to achieve is: www.site.com/en/?page=contact
to change to: www.site.com/en/contact
and also links like this for example: www.site.com/en/?page=test&category=tester
to change to: www.site.com/en/test/tester
my .htaccess
is like so:
RewriteEngine on
RewriteRule ^?page=([-\w]+)$ www.site.com/en/$1 [NC,L]
but I've have no luck with it.
For your first URL you can use:
RewriteEngine On
RewriteRule ^([^/]*)$ /en/?page=$1 [L]
it will leave you with the URL: www.site.com/en/contact
.
Your second rule will need to be:
RewriteEngine On
RewriteRule ^([^/]*)/([^/]*)$ /en/?page=$1&category=$2 [L]
Which will leave you with the URL: www.site.com/en/test/tester
.
Make sure you clear your cache before testing this.
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.