Forum Moderators: phranque
i have a site under my domain's root folder and index.php page is picket automatically when domain is called i.e
www.mydomain.com/index.php
but i want to send the request to another folder and index.php page in that folder should be browsed when domain name is called.. i.e
when www.mydomain.com is called it should take the visitor to www.mydomain.com/newfolder/index.php
but when someone writes www.mydomain.com/index.php then it must show the original index.php under root folder.
how can i do it with .htaccess?
thanks
________
For more information, see the documents cited in our forum charter [webmasterworld.com] and the tutorials in the Apache forum section of the WebmasterWorld library [webmasterworld.com].
Jim
DirectoryIndex /newfolder/index.html
But now i have started to face a problem with this .htaccess code,
I am redirected to /newfolder/index.html whenever a querystring is called by some application anywhere, e.g
on my blog i have links to comments as
[domain.com...]
but instead of showing this post i am redirected to the
[bizfriendz.com...]
same is happening for the urls like
[bizfriendz.com...]
it doesnt pick the index.php in the chat folder but brings me to the /newfolder/index.html
how can I control it? I dont want to be redirected like this but I just want to redirect users who types my main domain i.e
www.mydomain.com when browsed should go to www.mydomain.com/newfolder/index.html
I also tried the following code in .htaccess ,
<LocationMatch "^/$">
DirectoryIndex /newfolder/index.php
</LocationMatch>
the idea behind this was to redirect root folder requests only to the new folder otherwise dont redirect.
but now i am getting 500 internat server error.
thanks in advance
You can (and should) check your server error log to confirm this.
As your requirements expand, the number of available solutions decreases. It's a good idea to spend your time tightly defining the problem before looking for a coded solution.
If you wish to redirect only root directory index requests with blank query, then I'd suggest:
Options +FollowSymLinks -MultiViews
RewriteEngine on
#
RewriteCond %{QUERY_STRING} ^$
RewriteRule ^$ /newfolder/index.php [L]
Jim