homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Home / Forums Index / Code, Content, and Presentation / Apache Web Server
Forum Library, Charter, Moderators: Ocean10000 & incrediBILL & phranque

Apache Web Server Forum

mod rewrite & Windows
Just give up?

 3:14 pm on Mar 12, 2009 (gmt 0)

I'll save readers the sorry details, but I've been trying and trying to set this up on Vista and nothing seems to work. The module is running, but attempts to rewrite fail. The pages are located in the Documents folder (by means of an Alias) so that I can modify the pages without Administrator privileges.

I did a lot of searching on the Internet (including some threads on this forum), and found that others have had similar difficulties. This isn't specific to Vista; people have had the same problems on XP and 2000.

I've decided do this by placing .htaccess files on the host server, which is a Linux account, and using a test home page to debug it. I'll just use "real" URLs on my development PC.

Have others here been forced to the same conclusion?



 5:07 pm on Mar 12, 2009 (gmt 0)

but attempts to rewrite fail.

I.e. HTTP 404 for requests which should match your rule? Please make sure that AllowOverride FileInfo is set for that directory and post

- the physical and URL path to your .htaccess file
- the way teh request was mapped to the file system (you're talking about an Alias, so you're using
Alias / "C:/path.../"?
- the URL-path you requested
- RewriteRules used.


 7:01 pm on Mar 12, 2009 (gmt 0)

Thanks Caterham.

Yes, I'm getting HTTP 404s, and AllowOverride is set to All for that directory. Otherwise:

- Physical path: C:\Users\MyName\Documents\MyProject\MyDomain
(no spaces anywhere).
- Corresponding URL: [localhost...]
- Alias Directive: Alias /MyDomain C:/Users/MyName/Documents/MyProject/MyDomain
- Path requested: [localhost...]
- Rewrite rules:

RewriteBase /MyDomain
RewriteRule ^/MyDomain/page1\.html$ /page2.html

plus many different permutations of this humble attempt at creating a rewrite rule. By this point I could write a book about writing rewrite rules, but I'd have to rewrite it if I ever figure out how to rewrite correctly.


 7:35 pm on Mar 12, 2009 (gmt 0)

I have been using Windows Server 2003 with Apache 2.054, and have been able to get mod_rewrite to work. The biggest hurdle was needing to change my custom 404 page be referenced by .htaccess instead of httpd.conf, as the 404 page was intercepting the mod_rewrite url as a bad request.

This site was the best resource for me getting started:


 7:45 pm on Mar 12, 2009 (gmt 0)

Thanks vincenz66, I'll look into that immediately.

edit: Wait a minute, I don't have a custom 404 page.


 8:21 pm on Mar 12, 2009 (gmt 0)

Ok. Make sure the httpd.conf file is not directing 404 errors to a standard page. Search on 'ErrorDocument' directive. Also, make sure the 'mod_rewrite.so module' is enabled in the conf file and exists on your server usually 'C:\Program Files\Apache Group\Apache2\modules' , you probably already did this, but just in case.

Also can you please post your Rewrite commands?

Here is one of mine for reference, but there are a number of ways to doing it:

# Rewrite URL for SEO #
Options +FollowSymLinks
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

## Index Pages ##
RewriteRule ^events/index/([A-Za-z]+)$ /eventinfo/index.php?region=$1


 8:25 pm on Mar 12, 2009 (gmt 0)

The variable captures (A-Z) capital letters, (a-z) lower case letters, and the '+' sign signifies the length of the variable may vary in length. If your capture includes numbers, you would have to add (0-9).

Hope this helps!


 8:39 pm on Mar 12, 2009 (gmt 0)

RewriteBase /MyDomain
RewriteRule ^/MyDomain/page1\.html$ /page2.html

that should read

RewriteEngine on
RewriteBase /MyDomain/
RewriteRule ^page1\.html$ page2.html [L]


 9:34 pm on Mar 12, 2009 (gmt 0)

For efficiency, you nearly always replace the [A-Za-z] pattern, with just [A-Z] and the [NC] flag.


 10:48 pm on Mar 12, 2009 (gmt 0)

Well, so long as people seem to find this interesting I'll continue.

I moved

RewriteEngine on

out of httpd.conf and into .htaccess. I then comment out all text except for that one line (the same result happens whether I do or don't). Once that has been done, trying to access any page, even ones that I can normally access, produces an HTTP 403 - Forbidden. In the FF window the following message appears:

"You don't have permission to access /MyDomain/whatever.html on this server."

Trying [localhost...] which normally lets me view index.html returns a 403 with

"You don't have permission to access /MyDomain/ on this server."

Does this make sense to anyone?


 8:37 am on Mar 13, 2009 (gmt 0)

produces an HTTP 403

You don't have FollowSymlinks enabled, see the Options [httpd.apache.org] directive. That should tell you your error.log as well.


 12:04 pm on Mar 13, 2009 (gmt 0)

Yes, adding FollowSymlinks did it. Without really thinking I figured that that's only for *nix, but NTFS has Reparse points which are for the same purpose.

Thank you!

Global Options:
 top home search open messages active posts  

Home / Forums Index / Code, Content, and Presentation / Apache Web Server
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved