Jump to content

requinix

Administrators
  • Posts

    15,266
  • Joined

  • Last visited

  • Days Won

    431

Everything posted by requinix

  1. In PHP, it's basically either associative or not. An array. Sometimes "list". Not just string. Associative is when the keys have some sort of particular meaning. You could have an associative array for weekday names. You could also have a non-associative ("list") array for weekday names. And they could even be the same thing. What matters is how the array is used. Yes: by creating an array where you define the first entry.
  2. I don't know, you tell me. Does it work?
  3. Still the same thing.
  4. As long as your files only ever have the one period in their names, I guess. Otherwise I would tell you to get the name without the extension, add your suffix, and then add the extension. pathinfo() would help with that.
  5. Use glob().
  6. Write your own authentication provider that queries the SMF database.
  7. RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME}.php -f RewriteRule .* $0.php [L]
  8. I'm tired. RewriteCond %{REQUEST_FILENAME} !-f RewriteRule client1/gallery/(.*)$ client1/gallery/photo-gallery.php?gallery-id=$1 [L,R=301] That was your original code. Remove the [R] flag and only the [R] flag. Then make your link look like what I put in my last post.
  9. Think of another .php file you have on the site. Pick any one. Do you want to be able to access that one without the .php extension too?
  10. Do not put the gallery-id thing into your links. <a href="/client1/gallery/2019-holiday-party">
  11. Okay. But do you want to support other .php files? I will not ask a fourth time.
  12. Let me summarize what we covered in the first few posts: 1. The URL in the address bar is changing 2. [R] tells mod_rewrite that it should tell Apache that it should tell the browser to redirect to the new URL 3. You have a [R] in that rule I can't make it any more clear than that without actually giving away the answer.
  13. I don't understand how you could possibly be confused about what the URL is. Your browser seems to be remembering the redirect. Try an incognito/private window, or clear your cache.
  14. Depends on the answer to the "do you want to support other .php files" question I asked earlier.
  15. Yeah. When dealing with this stuff you need to think in terms of what you want the server to do, not the user experience. Because they aren't always the same. Do you want to support other .php files? Is a file. $ is end of input (end of the request URI). \? is a question mark. The purpose is to make sure that the request URI, which includes the query string, contains a .php at the end. Yes.
  16. I never said it was correct. I said your understanding of how the process works was correct - at least up to the part about redirecting. I then corrected you on how it works when you do and don't include the [R]. So you should now understand why what you have is not working the way you want, and what you need to do to fix it.
  17. Not this time 😁 This specific rule really is about removing the "menu.php". The other rule (which you haven't shown) is about adding it. Doesn't matter if you're hiding it, however... Right. You need something to add the extension back in. Apparently instead of the rule you posted, which tries to remove menu.php entirely. For adding extensions you need two rules: obviously the one to add the extension, but you should have another rule to remove it if someone tries to go to /menu.php because of SEO stuff. Here is the second one because it's a little more interesting. Try coming up with the first one yourself. RewriteCond %{REQUEST_FILENAME} -f RewriteCond %{REQUEST_URI} \.php($|\?) RewriteRule (.*)\.php$ $1 [L,R=301]
  18. It's not bad. It just isn't what you want to do. At least in this thread. In your other thread, you do want the [R] on that menu.php rule because you want the user to see the /whatever/ URL. I assume. The rest of the stuff you said was right.
  19. Oh, yeah, sorry I kinda glossed over it: you're removing /menu.php entirely. Presumably you have menu.php as an index, or have set up another rewrite so that /whatever/ is mapped to /whatever/menu.php.
  20. Not quite. mod_rewrite will rewrite and "tell" Apache about the new one automatically. That's its whole point. Base functionality. You don't need [R] to do that. What [R] means is "figure out the new URL and send it to the client with a 3xx redirect".
  21. Right so far. So if [R] means redirect...
  22. Do you know what the [R] flag to RewriteRule means?
  23. You've written a rule that will turn /menu.php into /menu.php. People think of this stuff backwards. You are not removing the .php extension. You are adding it. As in you want someone to see /menu in their browser and have the server add the .php extension.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.