I’m tiring to get all string before first slash when an url ends with “word1” or “word2”, and im using this code:
RewriteRule ^(.+)/word1|word2/?$ index.php?query=$1 [NC]
I haven’t any problem with url that have “word1” on his ends, but if the url ends with “word2”, Apache dose not return any value to “query” variable
You need to group the alternations in your expression:
Without the grouping your expression means:
^(.+)/word1orword2/?$