TalkPHP

TalkPHP (http://www.talkphp.com/forums.php)
-   Absolute Beginners (http://www.talkphp.com/absolute-beginners/)
-   -   Files appear as folders? (http://www.talkphp.com/absolute-beginners/4702-files-appear-folders.html)

Randy 07-07-2009 07:41 PM

Files appear as folders?
 
So I think you would need to use .htaccess to make this work but wasnt sure where to put it so i put it in here.

Anyways I am trying to make my index.php appear as /index/ and about.php appear as /about/ and then if i put a file into a folder i create called about it comes out as /about/datacenter/

Example:
index.php = /index/
about.php = /about/
about/datacenter.php = /about/datacenter/

But i only want it to do it on certain files and folders as I do not want it to mess up other folders such as my whmcs install.

Any clue how I would do this?

Thanks,
Randy

cecilia 07-07-2009 10:53 PM

oops, sorry it seems applied to a non-index file it displays the file name too so it doesnt work. Sorry

Randy 07-08-2009 03:34 AM

Alright so I know you use mod_rewrite but i have yet to find a tutorial that explains it good..

cecilia 07-08-2009 03:14 PM

OK I tried a different approach, not sure if this is ok.

What I did:
1. made a folder named testing
2. made a file named index.php inside testing folder
3. made an anchor on another page that points to just the folder: 'testing/'
4. It opens a page but it just displays ...testing/ on the URL

I know the file name is index.php but does it matter? It is still a page and it does display the folder name alone. I mean the output looks the same.


To get:
/about/datacenter/

Would be:
about/datacenter/index.php


Well, this is all I can think of right now, sorry if it doesnt work for you.

Randy 07-08-2009 06:20 PM

I know that way that is how the current site looks :p I am looking to make it easier on me to not have soo many actual folders.

Randy 07-08-2009 06:55 PM

Alright so I finally figured it out, but the site i got it from is EXTREMELY confusing so Ill give it to yall in short.

create your .htaccess file

and turn the rewrite engine with the following code:
PHP Code:

RewriteEngine On 

then lets create our rewrite rule of which file we want to be which folder with the following line:
PHP Code:

RewriteRule ^spacespace.html 

space.html will be the name of the file you want to change and and where it says ^space$ simply change the 'space' part to what you want it to appear as.

Tada!

8-)

Thanks for help tho cecilia.


All times are GMT. The time now is 01:00 AM.

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0