I have a bit of a dilemma with mod_rewrite.
How to write a rule that solves the following:
If I browse / en / page / page , I want to rewrite this:
? index.php language = ep & page = / page
BUT, if I only view / page , I want to rewrite this:
index.php? Page = / Page
Is it possible?
Edit:
/ page is just random dynamic pagename, it can also be independent .
I need a rule that checks like / se == a string, and no more than two characters> / page → index.php? lang = se & page = / page, and if the page / view page is visible that / page == is more than 2 characters and rewrite to index.php? page = / page
Edit2: Found anser to my question:
Rewriteengine on
RewriteBase /
## Check if its not a filename or dirname
RewriteCond% {REQUEST_FILENAME}! -L
RewriteCond% {REQUEST_FILENAME}! -F
RewriteCond% {REQUEST_FILENAME}! -D
## Rewrite rules
RewriteRule ^ (. {2}) / (. *) $ Index.php? Lang = $ 1 & page = $ 2 [L]
RewriteRule ^ (. *) $ Index.php? Page = $ 1 [L, QSA]
source share