简体   繁体   中英

how do i rewrite url to remove ?id=13

Hello can anyone help me out being trying to remove some part of my url eg:

From this

http://localhost:8888/www.mysite.com/admin/account_expenses?return=account1

To this

http://localhost:8888/www.mysite.com/admin/account_expenses?

And I would like it still be able to $_GET['return'] value to echo error. and also how to apply to my other like that.

Thank you.

One quick question is where is the URL coming from, is it from a form or from a link . If it is from a form, then your form attribute method="GET" should be method="POST" . If it is from a link then you will use htaccess to format the URL as @vishnu stated.

RewriteCond %{QUERY_STRING} ^(.+)&return=[0-9a-z]+&(.+)$ [NC]
RewriteRule ^ %1 [R=301,L]

add this code to folders .htaccess file then you will able to get the variable value using $_GET without present paramenters in URL

RewriteEngine On
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^?]*)\? 
RewriteRule ^(.*)$ http://www.example.com/admin/account_expenses? [R,L]

Try this instead for redirection to your page http://www.example.com/admin/account_expenses?

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