views:

379

answers:

1

Here is my .htaccess now

rewriteengine on
rewritecond %{HTTP_HOST} ^www.example.com$ [OR]
rewritecond %{HTTP_HOST} ^example.com$
rewriterule ^index.php/? "http\:\/\/example\.com\/" [R=301,L] #4a397bb852bc9

Which sends all requests from the root directory to index.php What I need to do is send all requests from www.example.com/site2/ to www.example.com/site2/index.php

My understanding of regex has always stopped short of these curious rules and conds

Thanks, Joe

A: 

The rule you named redirects any request, that’s URL path starts with index.php followed by an optional slash and that’s host name is either www.example.com or example.com, with the status code 301 to http://example.com/.

But if you want to rewrite requests from one directory to another, try this rule:

RewriteRule ^folder-1/?([^/].*)?$ folder-2/$1 [L]


Edit   In response to your comment:

RewriteCond $0 !=site2/index.php
RewriteRule ^site2/.* site/index.php [L]
Gumbo
AH. As you may have surmised, I did not create this .htaccess file. I am simply trying to edit it so that I can attempt to use url-rerouting in a subfolder of a server.
Joseph Carrington
I'm not sure if what I am trying to do is rewrite a request from one directory to another. I want all requests outside of /site2/ to remain outside of it, but all requests inside /site2/ to point to /site2/index.php
Joseph Carrington