Timeline for how to prefer static page if it exists over wordpress page
Current License: CC BY-SA 4.0
5 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Jul 8, 2022 at 8:49 | vote | accept | philolegein | ||
Jul 8, 2022 at 8:44 | comment | added | MrWhite |
@philolegein Sorry, I missed the foo on the RewriteCond directive! I've also removed public/ so that it matches any relative URL-path (need to also add a slash to the character class in that case). Rather than literally matching anything (ie. (.*) ) it is still advisable to be more restrictive with the regex and match actual files (that contain a file extension). I've updated my answer.
|
|
Jul 8, 2022 at 8:37 | history | edited | MrWhite | CC BY-SA 4.0 |
Update to fix condition (missed "foo"). Updated regex to match any file path.
|
Jul 8, 2022 at 7:12 | comment | added | philolegein |
Awesome! I had to fiddle a little bit to get it to work: the second RewriteCond needs to check in the foo dir: RewriteCond %{DOCUMENT_ROOT}/foo/$1 -f . And the rewrite rule to generate the $1 should match anything (so it gets the /foo/page-b.css , in addition to the public stuff: RewriteRule ^lp/[\w-]+/(.*)$ /landing-page/$1 [L] . I already upvoted, but if you want to make those changes, I'll mark as correct.
|
|
Jul 7, 2022 at 11:01 | history | answered | MrWhite | CC BY-SA 4.0 |