Apache, URLs and mod_rewrite
I'm trying to set up my remote hosted website (Apache) so that the URLs is useful to users and Search Engines alike, but here's my problem. myURL.com below is just an example.
I own http://www.MyURL.com (and by extension, http://myURL.com). In the root of my site (with .htacess, robots.txt, etc) is a file called index.html. I don't want this to be what they see when they go to my website. * If someone types in www.MyURL.com, Apache fetches index.html. How does it know to select this one? No filename was given, only a directory name. * What I'd like it to fetch is in a subdirectory from the root, /flatpress/. It's index.php. If I manually type www.MyURL.com/flatpress, it knows to grab index.php. Again, how does it know? I imagine it's an Apache config file I don't have access to. I'd like http://www.MyURL.com/ and http://myURL.com/ to fetch and display the file at /flatpress/index.php while still showing the URL http://myURL.com in the browser. I've tried to use RewriteEngine (mod_rewrite) to accomplish this, but it fails miserably. Help? And now that I look at it, TFP does it exactly like I want. Typing http://tfproject.org/ is the same as http://www.tfproject.org, and both redirect to http://www.tfproject.org/tfp without showing a filename like forum.php or whatever it'd be. |
There's an apache directive called DirectoryIndex, where you set the default page to load. It defaults to index.html, which is how Apache knows that--although it could be anything. But you can't tell it to look inside a subdirectory.
When I set up a blog site for one of my big clients with a bunch of blogs, I extract the Wordpress tarball, which puts the goods in /wordpress. I move everything from that directory out into the root of the site. I'd actually recommend you do the same--move the contents of flatpress/ to /. That's going to be the cleanest and lest-configuration way to do this. mod_rewrite is a disaster--and I work with it frequently. I really pity somebody trying to figure it out for the first time. You could also change the Directory of your virtual host to point at the flatpress directory, if you have access to the machine's apache config files. You can't do that from .htaccess. |
HAHAHA I can't believe I didn't think to just move the contents down a layer on the filesystem. Thanks a ton, Ratbastid. :)
|
All times are GMT -8. The time now is 02:20 PM. |
Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Search Engine Optimization by vBSEO 3.6.0 PL2
© 2002-2012 Tilted Forum Project