I am new here on InfinityFree and trying to set up my site www.villaduparc.info
To start with I have loaded up the old website in a directory …/villaduparc.info/htdocs/VDP-Old/ Later I plan to move over the new wordpress site I have developed. I don’t want to fill up the root directory - that being the reason for moving everything to the subdirectory VDP-Old.
My problem is getting traffic directed there. When someone writes www.villaduparc.info I want the redirected to www.villaduparc.info/VDP-Old
WHere I had things hosted previously I would set up a redirect www.villaduparc.info to www.villaduparc.info/VDP-Old I tried doing this on cpanel by using the redirects: Add/Remove Redirects I changed the villaduparc.freecluster.eu to villaduparc.info and clicked the button “alter redirects”. On the next page I filled in http://villaduparc.info/VDP-Old and clicked the butoon “Redirect itl”. The result was an error message (403) Forbidden You don’t have permission to access /panel/indexpl.php on this server.
What am I doing wrong ?
Anyway I thought I could do it a different way and copied a htaccess file I had from before and placed it in /villaduparc.info/htdocs/ The file looks like this:
RewriteEngine on
RewriteCond %{HTTP_HOST} ^(www.)?villaduparc.info$
RewriteCond %{REQUEST_URI} !^/VDP-Old/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /VDP-Old/$1
RewriteCond %{HTTP_HOST} ^(www.)?villaduparc.info$
RewriteRule ^(/)?$ VDP-Old/index.html [L]
First of all, never use the Redirects tool to redirect back to the same domain or a domain in the same folder. I’m not sure why the tool lets you do this in the first place, because it will always lead to a redirect loop.
I made an error page and put it in the villaduparc.info/htdocs folder, and modified my htaccess file in the same folder - but it still comes up with the standard infinity error page
I modified the htaccess file in villaduparc.info/htdocs folder according to your suggestions - but no help
I tried adding the PHP code to the top of my index.htm file so the first 3 lines are:
header(“Location: /VDP-Old”);
but that did not help.
So to iterate:
I have entered an addon address villduparc.info via cpanel - which created a directory villaduparc.info and under that a directory called htdocs.
I have manually moved the old site in to a directory villaduparc.info/htdocs/VDP-Old
Everything works fine in the root directory (ie villaduparc.info).
Everything works fine if I type www.villaduparc.info/VDP-Old/
I am trying to get any user entering www.villadupar.info or villaduparc.info to go one folder down to villaduparc.info/VDP-Old/
I am just having a really hard time getting my head around this
Thanks for the help. To answer your questions - in the villaduparc.info/htdocs folder there was nothing. Everything was in villaduparc.info/htdocs/VDP-Old . By everything I mean htm files and image folder with image files. I do not have subdomains.
I wrote an index.php file where I copied the text you specified and placed it in the villaduparc.info/htdocs folder
I wrote an index.php file and copied the text you specified and placed it in the villaduparc.info/htdocs folder - but users still do not get rerouted to the subfolder. However I did discover that if I entered www.villaduparc.info/index.php in the browser then things seem to work.
So maybe I am a little closer - but still not there yet.
OK, after a lot of trial and error and googling - this seems to work:
a 404-page.htm for errors in villaduparc.info/htdocs folder
a htaccess file with the content below in the same folder as the error page
# redirect from root to subdirectory
RedirectMatch ^/$ /VDP-Old/
# redirect on 404 to subdirectory
ErrorDocument 404 /404-Page.htm
This is where I found the solution:
https://serverfault.com/questions/9992/how-to-get-apache2-to-redirect-to-a-subdirectory