mod_rewrite issues

Magentix

if (OP.statement == false) postCount++;
Reaction score
107
Basically I have these URLs:

domain.com
domain.com/directoryA
domain.com/directoryB
domain.com/directoryC

and I want domain.com to be redirected to domain.com/directoryA
yet directoryA, directoryB and directoryC should still be accessible directly.

I know how to redirect a directory to root, but how do I do it the other way around?

Code:
# redirect directory to root
RewriteEngine on
RewriteRule ^(directoryname/.*) /index.php?path=$1 [NC,QSA]

# the other way around? this gives 500 error or infinite loop
RewriteCond %{path_info} ^$
RewriteRule ^(.*)$ /directoryA/$1 [NC,QSA]
 

celerisk

When Zerg floweth, life is good
Reaction score
62
You can get a "not" condition with !


And then something like:

cond: it's not dirA
cond: it's not dirB
cond: it's not dirC
Rewrite here ...
 

Magentix

if (OP.statement == false) postCount++;
Reaction score
107
Yeah I know, but the site will have like a lot of directories.

What I'm trying to achieve is:

"Am I in a directory? ok cool, do nothing."
"Am I in the main directory or a file in the main directory? Go to DirectoryA"
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top