开发者

Removing GET commands from URL using .htaccess

开发者 https://www.devze.com 2023-02-20 08:21 出处:网络
I am trying to clean up URL开发者_如何学JAVAs for my website which uses a GET command to dynamically load a page:

I am trying to clean up URL开发者_如何学JAVAs for my website which uses a GET command to dynamically load a page:

domain.com/user/?name=david

How do I use .htaccess rules to remove the ?name=david so that the URL becomes:

domain.com/user/david


RewriteRule ^user/(.*)$ your_script?name=$1 [QSA,L]


Can you please try these rules in your .htaccess file:

RewriteCond %{QUERY_STRING} ^name=(.*)$
RewriteRule ^user/$ /user/%1? [R=302,NC,L]


It seems these .HTACCESS rules aren't all supported by the Lightspeed web server I'm using. Although it's based on APACHE, there are some differences it seems which prevent the rules from working - or at least that's what I seem to be finding when I'm reading up on why these rules aren't working.

0

精彩评论

暂无评论...
验证码 换一张
取 消