I'm wondering how do you use PHP to make it look like there are directories that don't even exist.
I can't point to specific websites but I've worked on existing code (didn't have a chance to look at the code that did this function) where there are pages that look like www.mydomain.com/products/inside/Model# but only the products directory existed. There was not inside directory.
How do you do this? Does it require special configuration via apache or can it be done in only php?
KrisSiegel.com - My Personal Website with my blog and portfolio Don't Forget to Rate Posts!
I've been reading through the guide but am not really understanding how to adopt this for my situation.
Like, say I have a url that looks like this: www.binaryidiot.com/?area=software&product=perspective. How can I make it so the area and product get variables are still get correctly but the URL is shown as www.binaryidiot.com/software/perspective?
KrisSiegel.com - My Personal Website with my blog and portfolio Don't Forget to Rate Posts!
RewriteEngine On
RewriteRule ^article/(.*)/$ index.php?area=news&id=$1
Still no go.
I then tried to modify visualAd's code because it had more slashes and ended up with something like this:
Code:
RewriteEngine on
RewriteBase /
RewriteRule ^/article/(.*)/ /index.php?area=news&id=$1
Still no go. I tested it on my current webserver as well as an internal apache server I have setup. Both looks like they're setup correctly. All of this is going into a .htaccess file as well in the same directory as index.php (I noticed in 1 of the articles it said to put it in the directory before the htdocs and I tried that as well with no luck).
So... what am I doing that's so wrong?
KrisSiegel.com - My Personal Website with my blog and portfolio Don't Forget to Rate Posts!
In the main server configuration file for thee document root directory container, you need to have an AllowOverride driective. This allows directives to be overriden in the .htaccess files.
I think I offically give up, lol. Still can't get anything to work. I thought it would be a simple .htaccess file or something but it doesn't work on my local server or remote server. Bah!
Here is my .htaccess:
PHP Code:
RewriteEngine on
RewriteBase /v4/
RewriteRule ^/v4/Article/(.*)/ /index.php?area=news&id=$1
I am putting that in the same directory as my index.php file (which resides in localhost/v4/). I tried changing it around like I mentioned before.
Attached is my httpd.conf file but I only changed the 1 thing you said (everything else is default). Though I saw you mention that the httpd.conf should go in the directory that you want the morph the DLLs. I thought it was supposed to go into only the conf directory.
KrisSiegel.com - My Personal Website with my blog and portfolio Don't Forget to Rate Posts!
I am not using user_dir directories. It's just http://localhost/v4/Article/5. My remote server has this enabled though so maybe I'll try that again.
Is there anyway to make it work without user_dir?
You need also to enable FileInfo in the document root directory container too. URL rewriting is only cconerned with the URL, the location of the file on the server is irrelevant.
At present your entire document root directory container is commented out. Therefore, Apache will ignore it:
Code:
#<Directory "E:/apache/htdocs"> <---- a # at the beginning of a line makes it a comment.
#</Directory>
Thanks for all your help visualAd. I think I may agree with apache's docs about mod_rewrite
With mod_rewrite you either shoot yourself in the foot the first time and never use it again or love it for the rest of your life because of its power. This paper tries to give you a few initial success events to avoid the first case by presenting already invented solutions to you.
I don't know why I still can't get it to work, lol. Honestly, I wanted a solution that I could just include in my .htaccess or something that way I could easily drop my website onto another server because I will most likely be changing servers sometime this year and possibly again next year. If I have to attempt to configure apache everytime (something I don't even have access to via my shared hosting right now), this solution probably won't work the way I want. I was hoping for something that would either turn a neat looking URL into something my PHP scripts could use like normal or maybe a way to use a php file to process all my URLs (like no matter where you go on my site, the URL is sent to 1 PHP script to determine where to put you).
Thanks again though. I'll keep trying for a little while longer heh
KrisSiegel.com - My Personal Website with my blog and portfolio Don't Forget to Rate Posts!
Did you make the changes I suggested above? It will work if you make them.
Yeah it still didn't work. The odd thing is, Apache's service died about an hour or so after making the changes and I couldn't restart it. Attempting to restart the computer also did nothing so I had to unisntall it; lol. I'll reinstall and try again later. I also will e-mail my host to see if my remote server supports this.
KrisSiegel.com - My Personal Website with my blog and portfolio Don't Forget to Rate Posts!