I am using some url rewriting for a site I am currently working on. I have the rewriting working fine for numbers, letters and – using this:
RewriteRule ^([a-zA-Z0-9_-]+)/([a-zA-Z0-9_-]+)$ characters.php?realm=$1&name=$2 [NC]
However I need the first part of the rule to allow for ‘ to be allowed, and I need the second part of the rule to allow for special characters such as ú, æ, ä, ç, and pretty much all of the characters located here that resemble a letter.
I know special characters are bad, but I am not the one that allowed them to be used in character names. I just need them to be allowed in my rule so that the characters with those names can access my application.
Thanks.
Edit: The first part works now. Experimenting with the second part at the moment.
Edit #2: Trying both solutions for the second part ([^/]+) and excluding certain characters allows for the information to display instead of resulting in a 404 error. However it is causing my CSS to not be displayed, instead it is trying to call /css/error instead of /css. It is causing a redirect loop for the css file according to chrome.
The only way something should be redirected to /error is if the character data is invalid. This application is being used to pull character information from the blizzard character api, so it is essential that the accented characters can be used in the rewriting.
I’m not sure if this is important or not, but when I to allow for just ú to be included along with a-z and A-Z I get a 404 error stating that the page cannot be found but instead of displaying the ú it displays ú in its place.
^([a-zA-Z0-9_’-]+)/([^excluded characters here]+)$
adding the “‘” inside the first brackets should allow it to be matched. As far as the second goes, you may want to use a negated character class, and list the characters that you do not allow.
edited to move the single quote before the “-“.