简体   繁体   中英

.htaccess SEO friendly URL with queryString

I have a page like:

page.php?mode=dashboard&hl=en

and i want to use like:

site.com/dashboard?hl=en

how must i use RewriteRule? Thanks...

EDIT: I think this is not possible with .htaccess. Need to use javascript.

wish it helps you

# Redirect /Category.php?Category_Id=10&Category_Title=some-text
RewriteCond %{ENV:REDIRECT_STATUS} ^$
RewriteCond %{QUERY_STRING} ^Category_Id=(\d+)&Category_Title=([\w-]+)$
RewriteRule ^Category\.php$ /Category/%1/%2? [R=301,L]

You may be able to use this code in site root .htaccess:

RewriteEngine On

RewriteCond %{THE_REQUEST} /page\.php\?mode=([^\s&]+)&(hl=[^\s&]+) [NC]
RewriteRule ^ /%1?%2 [R=301,L]

RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(\w-]+)/?$ page.php?mode=$1 [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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM