Mobile app version of vmapp.org
Login or Join
Murray432

: Creating sub-directories in public_html without effecting higher scope files ( index.php ) I have in my Navigation bar: "example.co/index.php (home), example.co/action.php, example.co/car.php /etc".

@Murray432

Posted in: #Directory #Htaccess #WebDevelopment #WebHosting

I have in my Navigation bar:
"example.co/index.php (home), example.co/action.php, example.co/car.php /etc".

Now I have my games in the "/games/" directory

But once I click on a game in /games/ directory "example.co/games/mario" //(that's what I want my games to be called)

EVERYTHING on the page scopes to games/ directory. For example example.co/index.php becomes example.co/games/index.php

example.co/games/action.php


(It shouldn't do that. It should remain example.co/index.php)
And then things start breaking 404 error.



I don't know if .htaccess is exactly necessary. But I believe I could make this work if I put EVERYTHING In public_html directory. and then used .htaccess to change games/ name. But I don't know the code to use...

Perhaps something along the lines of

# Rewrite for (ALL the games).php
RewriteRule ^games/(ALL the games).php [NC,L]


Any ideas? I'm just clueless there's 1000 possibilities here... I'd rather not drive myself crazy moving unnecessary files around.

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @Murray432

1 Comments

Sorted by latest first Latest Oldest Best

 

@Becky754

Your links within your navigation are relative and not absolute. For example:

<div id="NavBar"><a href="index.php" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Home','','images/images/Nav_Over_01.gif',1)"><img src="images/Nav_Bar_01.gif" alt="Home" width="119" height="44" id="Home" /></a>


versus:

<div id="NavBar"><a href="/index.php" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Home','','images/images/Nav_Over_01.gif',1)"><img src="images/Nav_Bar_01.gif" alt="Home" width="119" height="44" id="Home" /></a>


...where I put a / before index.php. See if that helps.

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme