Forum Moderators: phranque
and I make follow jdMorgan answer
my directory structure is :
/index.php
/web/index.php
After I follow answer it not work
but if i delete index.php both director it work !
but i need to use /web/index.php Can help me ?
thank for answer.
RewriteEngine on
Options +FollowSymlinks
RewriteBase /
RewriteRule ^(([^/]+/)*[^./]+)$ http://www.example.com/$1/ [L,R=301]
RewriteCond %{HTTP_HOST} ^(www\.)?mydomain\.com
RewriteCond %{REQUEST_URI} !/domainfolder/
RewriteRule ^(.*)$ domainfolder/$1 [L]
it can redirect if in folder /domainfolder not have index.php
but I need use index.php in /domainfolder/index.php
Options +FollowSymLinks -MultiViews
Jim
Apache error log nothing and Apache access log show this
110.164.x.x - - [30/Nov/2009:01:07:43 +0700] "GET / HTTP/1.1" 200 33 "-" "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; .NET CLR 2.0.50727; InfoPath.1; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; .NET CLR 1.1.4322; OfficeLiveConnector.1.4; OfficeLivePatch.1.3)"
I type url as example.com and www.example.com but it not work both.
I explain my file in both directory
my directory structure is :
/index.php
/web/index.php
inside file :
$ cat index.php
Not Redirect
$ cat web/index.php
Redirect Success
it mean if url is forwarding my webpage must show Redirect Success if not it shot Not Redirect
thank for your answer
Do you have any other URL-rewriting code -- such as more mod_rewrite code or Alias or ScriptAlias directives in either a .htaccess file above this one or in the server configuration files (perhaps added by control panel or by installing a blog, forum, or shopping cart script package)?
Jim
please see this
$ pwd
/home/example.com/htdocs
$ cat .htaccess
RewriteEngine on
Options +FollowSymlinks -MultiViews
RewriteBase /
RewriteRule ^(([^/]+/)*[^./]+)$ http://www.example.com/$1/ [L,R=301]
RewriteCond %{HTTP_HOST} ^(www\.)?example.com\.com
RewriteCond %{REQUEST_URI} !/web/
RewriteRule ^(.*)$ web/$1 [L]
$
Are you on Apache 2.x? If so, try adding
AcceptPathInfo off
Your requests both returned a 33-byte response. So what was on that 33-byte page? Did you do a View->Page-source in your browser to check?
Jim
It still not redirect. --
Can see following message from header check
=============================================================
Requesting www.example.com .. Ok
Reply received (reply time: 141 ms)
-----------------------------------
HTTP/1.1 200 OK
Date: Wed, 09 Dec 2009 15:09:02 GMT
Server: Apache/2
Vary: Accept-Encoding
Connection: close
Content-Type: text/html
Not Redirect
=============================================================
If I change .htaccess rule by comment two line RewriteCond
header it show this
=============================================================
Requesting www.example.com .. Ok
Reply received (reply time: 156 ms)
-----------------------------------
HTTP/1.1 500 Internal Server Error
Date: Wed, 09 Dec 2009 15:22:42 GMT
Server: Apache/2
Vary: Accept-Encoding
Content-Length: 669
Connection: close
Content-Type: text/html; charset=iso-8859-1
=============================================================
But according to the last version of the code you posted, you should be requesting "www.example.com.com" -- That is the hostname required by your first RewriteCond.
Make sure that hostname pattern in the RewriteCond is correct.
Jim