简体   繁体   中英

universal “/success” that shows message if added

I have a problem and I don't know if it's possible but I'm going to ask here. I have rewrite rules like this:

    RewriteRule ^login$ index.php?page=login [NC]

and I want to do something like this, if you add "/success" then the url will look something like this:

 "mydomain.com/login/success" 

and that will add a $_GET variable to the url and the original url will be:

"index.php?page=login&status=success".

I want to be able to add /success to every page that I have, example: mydomain.com/register/success and so on..

Thanks!

Allright, first thing:
This is not how URI Rewrite works. Sorry man but you really need to study a bit more on the topic.

To solve your issue you need to:

  1. Get the URI using PHP Global Vars
  2. Process it and extract your parameters

There is no way .htaccess will be able to do what you are looking for. I don't usually post my stuff, but i suggest you to read some of the source code of a project i've been working on a few months to understand how routing works. URLParser Example here

Unfortunately to properly understand my code you have a minimal notion of MVC. Hope it helps!

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