php - What RewriteRule shall I add to my existing rules to fix this? -
my page has 2 languages (in near future 3). has structure on inner pages:
domain.com/en/page (where page page.php in main root)
and main page can accessed through domain.com
or domain.com/en/
in server have files in main root, , 1 folder named articles, inside there other files.
when access index of folder articles index domain.com/en/articles
ok.
but when access domain.com/articles
takes me 404 page.
how can still open folder without /en/
or /el/
in front of it?
rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewriterule ^(en|el)/articles$ articles/index.php?lang=$1 [nc] rewriterule ^(en|el)(/)?$ index.php?lang=$1 [nc,l] rewriterule ^(en|el)/(.*)?$ $2.php?lang=$1 [nc,l] rewriterule ^([^\.]+)$ $1.php [nc,l]
also, because new in htaccess please take @ overall code , tell me improvements.
you can have rules this:
rewriterule ^articles/?$ articles/index.php [nc,l] rewriterule ^(en|el)/articles$ articles/index.php?lang=$1 [nc,l,qsa] rewriterule ^(en|el)/?$ index.php?lang=$1 [nc,l,qsa] rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewriterule ^(en|el)/(.+)$ $2.php?lang=$1 [nc,l,qsa]
Comments
Post a Comment