I need an .htaccess file that rewrite everything to the index.php of my site that is www.examplesite.com
.
Example : I open www.examplesite.com/designs/designs.php?tab=2013
and I want the site to load http://examplesite.com/index.php
in background, while staying on the same URL. The sub-folder designs
and the file designs.php
will not exist on the server, and will be loaded from an other server inside of the index.php
depending of the entered URL.
My .htaccess already contains some things, I don't really know what it means but I think I need to keep the beginning up to the RewriteCond, I'm not sure about that :
RewriteEngine on
# -FrontPage-
IndexIgnore .htaccess */.??* *~ *# */HEADER* */README* */_vti*
<Limit GET POST>
order deny,allow
deny from all
allow from all
</Limit>
<Limit PUT DELETE>
order deny,allow
deny from all
</Limit>
AuthName www.examplesite.com
AuthUserFile /home/designerr/public_html/_vti_pvt/service.pwd
AuthGroupFile /home/designerr/public_html/_vti_pvt/service.grp
RewriteCond %{HTTP_HOST} ^an_other_domain_i_own\.com$ [OR]
RewriteCond %{HTTP_HOST} ^www\.an_other_domain_i_own\.com$
RewriteRule ^/?$ "http\:\/\/examplesite\.com" [R=301,L]
I noticed there is a 301 redirect, I will probably need to build a site-map to be indexed again.
So, what should I put in the new .htaccess ? I also need to know in my PHP code what is the actual URL seen by clients, I think it's with $_SERVER['REQUEST_URI']
or $_SERVER['REDIRECT_URL']
, I'm not sure.
*By the way the real name of my sites are not examplesite.com
and an_other_domain_i_own.com
, but I changed it in this post to ensure that the publication of my .htaccess does not provide you any ways to hack my site or any things like that.
You could try these rewrite rules (provided your top line remains: rewrite engine on)
These statements direct calls to index.php if the directory & file cannot be found on the server.
REQUEST_URI would provide the url