Hi People

I have a url, http://www.domain.com.au/domain1/domain2.php .
Now I would like to remove the middle man aka folder from ever being seen so the url changes to, http://www.domain.com.au/domain2.php .
I have done some research and mod_rewrite looks to be the go in the htaccess file. So can anyone give me some examples or point me in the right direction?

Thankyou, Regards X

Recommended Answers

All 7 Replies

Thanks but I have already gone through the apache manuals but it was very overwhelming at first and still could not reference what I required. I was hoping for a simple example inparticular the modrewrite for the folder but even something similar so I can gather a better understanding of the modrewrite function and then utilize it to my own requirements.

My htaccess file was spewing out errors when I used the code.
Any ideas? possible php.ini declerations? Thanks.

Options +FollowSymlinks
RewriteEngine on 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteCond %{REQUEST_FILENAME}\.php -f 
RewriteRule ^(.*)$ $1.php

Note: The Error is "Internal Server Error"

is mod_rewrite available on the server?

Yes it is I forgot to turn it on my test server :D Ha Ha

The closest I have come across from your examples was:

Example #5:
The following will rewrite the URL to http://yourdomain.com/directory/newpage.html when visitors browse to http://yourdomain.com/anypage.html
RewriteEngine on
RewriteRule ^([a-z]+).html$ /directory/newpage.html [R,NC,L]

I am still not understanding the logic between conditional statements and output. ^$ start and end the string, [a-z] alpha characters, + multiple characters, .html the extension, then what is directory/newpage.html signify?

im looking something close to that but not a specific page just general 'hidden' folder for every page.

Off to reread the apache module :(

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.