Topic: mod_rewrite on apache w/ windows (Read 1218 times)
aka J Love Community Supporter?
Bill Gates is my home boy
Gender:
Posts: 884
1636 credits Members referred : 4
« on: Sep 07, 2007, 07:14:30 PM »
i seem to be having some problems with the mod_rewrite module for Apache.. recently I have set up my personal computer (For the 2nd time) as a personal local test server for developing scripts. mod_rewrite seems to work great in the latest release of phpHaze, when uploaded to a live server such as my blog, but when im testing it on my local test server the generated rewritten links are not working, returns a 404 error. I have enabled the apache module mod_rewrite and PHP also picks up the module as being loaded through apache_get_modules(), any idea why this is not working? is there something I am missing?
aka J Love Community Supporter?
Bill Gates is my home boy
Gender:
Posts: 884
1636 credits Members referred : 4
« Reply #2 on: Sep 07, 2007, 11:26:06 PM »
im not sure i know exactly what you mean? there was only one place in my apache config that spoke of "mod_rewrite" or anything similair, so i just uncommented that line.
i also tried a few tests that i found in various places on the web and no luck.. im definately a noob when it comes to running my own server especially with all these modules are involved
I am a metal monkey!
Administrator Community Supporter?
Jedai Sword Master
Gender:
Posts: 7822
39867 credits Members referred : 3
« Reply #3 on: Sep 07, 2007, 11:30:14 PM »
Don't worry man, none borned knowing everything
Here is what you have to do :
Code:
<VirtualHost 127.0.0.1> ServerAdmin xxxxx DocumentRoot "x:/htdocs" ServerName localhost <Directory "X:/htdocs/"> Options All Includes Indexes RewriteEngine on # Here you can give your directives </Directory </VirtualHost>
aka J Love Community Supporter?
Bill Gates is my home boy
Gender:
Posts: 884
1636 credits Members referred : 4
« Reply #4 on: Sep 07, 2007, 11:34:16 PM »
ok so im adding this to my apache config file say at the top? of course changing the roots to where my docs are located, what about ServerAdmin xxxxx ? and should </Directory be </Directory> ? sorry for all the questions man and also, where you have "# Here you can give your directives" is this where I add the "code" for the actual url rewriting? in that case is the htaccess file even required? see i am very confused.. lol so here is my current htaccess file with the rewriting directives
Code:
Options +FollowSymLinks RewriteEngine on RewriteRule page-id-(.*)-view-(.*)-news_id-(.*)\.html$ page.php?id=$1&view=$2&news_id=$3
You will have to change the name of .htaccess to something else like "htaccess" without a preceding dot, or "htaccess.txt", and use the AccessFileName directive to tell Apache to use that new filename instead.
Windows and apache don't play nicely so if you doing serious dev work it might be time to think about a dedicated test box running a LAMP configuration
You will have to change the name of .htaccess to something else like "htaccess" without a preceding dot, or "htaccess.txt", and use the AccessFileName directive to tell Apache to use that new filename instead.
Windows and apache don't play nicely so if you doing serious dev work it might be time to think about a dedicated test box running a LAMP configuration
thanks but.. this does not work, or at least not for 2.2.4. "AccessFilename" does not exist in my apache config file, so just to see, i added it with this line "AccessFileName htaccess.txt" renamed my .htaccess file to htaccess.txt and still no luck. returns 404 on my local test serv but works fine on live server.
unless of course I am doing something wrong, which is probably the case
« Last Edit: Sep 08, 2007, 07:40:00 AM by Meth0d »
its the directive below the DirectoryIndex directive (at least with apache 2)
not really sure what you mean, or what I am supposed to do here.. sorry, remember when it comes to this i have no prior knowledge of how this works at all (apache config and mod_rewrite)
not really sure what you mean, or what I am supposed to do here.. sorry, remember when it comes to this i have no prior knowledge of how this works at all (apache config and mod_rewrite)
maybe its better to practice mod_rewrite on some machine where this feature is already working (like most of the shared web hostings)
aka J Love Community Supporter?
Bill Gates is my home boy
Gender:
Posts: 884
1636 credits Members referred : 4
« Reply #12 on: Sep 15, 2007, 06:59:45 AM »
nah.. that will not work for now.. i need to use my local test machine at home for this as I am changing entire PC's soon and buying a live web server , but in some time.. in the mean time, I need this free solution: set up my winxp unit as a local test machine to properly develop scripts and applications...
so any help from this point? still have no idea what the prob is..
aka J Love Community Supporter?
Bill Gates is my home boy
Gender:
Posts: 884
1636 credits Members referred : 4
« Reply #14 on: Sep 17, 2007, 11:54:09 PM »
well i didnt use WAMP or any packaged windows thing, i installed one by one by hand and config'd them way I wanted.. and i already have a shared hosting server where my main sites run, i used to do test work there but cant, its to lock-down, cant control error reporting and alot of other annoying things.
well i didnt use WAMP or any packaged windows thing, i installed one by one by hand and config'd them way I wanted.. and i already have a shared hosting server where my main sites run, i used to do test work there but cant, its to lock-down, cant control error reporting and alot of other annoying things.