I am making a sort of a-z index for HTML/CSS on my website. I made a “reference” folder and I have an index.php page in it. I want to be able to do index.php?reference=a and have the URL be rewritten to codefundamentals.com/reference/a/ (or if I point to this URL, I want it to work as if I went to index.php?reference=a).
However all attempts I make at this only show my homepage (root homepage) when I put in an htaccess rule and view. I believe this is because of my htacess being able to be affected due to my “index” code in my htaccess. How can my current index.php htaccess be rewritten to only affect the root directory, and then I can work on getting my reference folder htaccess working.
I think so, just to be clear index.php?reference=a doesn’t do anything on your site today right? At least from what I can tell it doesn’t. I simply want to make sure we don’t have an underlying problem of “that link should be working, but an existing rule is breaking it” that we must deal with first.
What online tester do you use for this @cpradio ? I used a bunch from Google and they ultimately all suck.
Also, you know how CSS is mainly debugged from inspect element? What’s the JS equivalent? I use the console and put console logs in my code to see what’s happening (alerts too) but I dunno if there is a better way (OT I know).
Aw, (re post #16) I KNOW that you know better than to:
escape the slash character in your regular expressions (it doesn’t need it).
redirect to the DocumentRoot with a / (that causes Apache to look to ITS root first so that’s a great advantage for hackers); It’s also not necessary if this .htaccess (mod_rewrite code) is located in the domain’s DocumentRoot.
using optional trailing slash characters will cause all internal links in the new {REQUEST_URI} to have two options for directory level of the request (meaning either the / version will be correct and the non-slash to fail to find internal links or visa versa). IMHO, absolute internal links are a terrible way to resolve this issue as I have never found any reason to have an optional trailing slash (except when redirecting to a DIRECTORY where that it the technically correct way to specify the link).