I'm working on a project with some friends that needs a little website I'm developping.
It's host on my computer using Wamp server, and I configured it this way :
C:\wamp64\www\projectfolder\
is the folder where my project is.http://example.online/
is the virtual host pointing to myprojectfolder
that I use to access my website locally.http://example.ddnsservice.org/projectfolder/
is the URL to access my website whenever I need to share it.http://example.ddnsservice.org/
i.e. points to the default wampserver page.
Working this way, all the relative links pointing to /
or /something/else/
are working when I use my virtual host URL but don't when I use the public URL. /models/
would redirect to http://example.ddnsservice.org/models/
instead of http://example.ddnsservice.org/projectfolder/models/
.
I've tried to use RewriteRule
on the .htaccess
file in projectfolder
following several solutions proposed here but nothing seemed to work so I begin to think that I have a deep misconception of what hosting a website should look like. The last thing I tried was:
RewriteEngine on
RewriteCond "%{HTTP_HOST}" "^(.*)example.ddnsservice.org(.*)$"
RewriteRule ^/$ ^/projectfolder/$
I didn't try to make http://example.ddnsservice.org/
point to the projectfolder
because I sometimes share others projects and because I don't know how to do it.
I'm pretty lost atm and don't really know from where to take this problem anymore.
Thanks everyone for reading me and giving a bit of your time.
--- EDIT ---
For a bit more details, those are the links messing up with me. Or I'm messing up with them, can't say! (I've just let the <a>
tags)
<a href="/?action=session_destroy">session_destroy();</a>
<a href="http://localhost">LOCALHOST</a>
<a href="/">ROOT</a>
<a href="/admin/">ADMIN</a>
<a href="/admin/?action=testPage">TEST_PAGE</a>
<a href="/?action=empty_session_key">$_SESSION['key']="";</a>
<a href="?">EMPTY GET</a>
<a href="?key=<?= $key['display_key'] ?>">KEY1</a>
<a href="?key=<?= $key['forum_key'] ?>">KEY2</a>
I realised reading your answers that I'm getting myself in difficulty. I don't need to host several projects at once so I could just configure Apache to point to my projectfolder
by default. I also thank a lot @BURN-ADDiCT for his personnalized tutorial as I can't do it by commenting if I understand the rules right.
I also realized that my choice to separate some restricted operation on my database in /admin/index.php
may be a bad idea, that's what causes me to use links relatives to the website/server root and I'll change this.
I'll work on this whenever I have enough freetime but for now the problem is fixed by the apache configuration solution. Thanks everyone for your time.