Seymour Clufley wrote:To recap, I'm using Xampp on an offline PC, testing a site stored in "P:\website\upload\". That's the root directory. It is set up in httpd.conf as an alias, called "slush".
Please paste this Alias Directive including several lines above and below from the httpd.conf file.
Ideally the Alias Directive would reside in the
.\apache\conf\extra\httpd-xampp.conf file with all the others of which there are several working examples - if your Alias is syntactically correct then try and move it into this file then restart Apache and this restart would be required after each edit session with any Apache conf file but not necessary when editing the .htaccess file.
Not sure yet if there is a need for a redirect when using an
Alias Directive as that is the intended use of an Alias any way.
- Code: Select all
Alias /slush/sub "P:/website/upload/slush/sub2"
<Directory "P:/website/upload/slush/sub2">
AllowOverride AuthConfig
Order allow,deny
Allow from all
</Directory>
Just tested this and it worked as you intended using
http://localhost/slush/sub/test.htmlYou can instead use
AliasMatch Directive with regex if you prefer.
Seymour Clufley wrote:Now, when I open the page "http://localhost/slush/sub/test.html", I get a 404 page and this in the error log:
Here's the line from the error log:
Fri Jan 23 15:15:41 2009] [error] [client 127.0.0.1] File does not exist: P:/website/upload/sub/test.html
The missing slush directory is added when the RewriteBase is correct
/slush see below but the .htaccess will still give a 404 error because the rule is not quite right.
Seymour Clufley wrote:Here's the htaccess file:
DirectoryIndex cover.html
AddType text/x-component .htc
Options +FollowSymLinks
RewriteEngine On
#RewriteBase /
RewriteCond %{REQUEST_URI} ^/sub/
RewriteRule ^/sub/(.*)$ sub2 [QSA,L]
I adjusted this and still a 404 error so not sure what is wrong as I ran out of time testing the rule - the
index works and the
addtype is irrelevant to the rewrite rule, the RewriteBase is correct now and eliminates the need to add
/slush into the rules
/slush/sub/:
- Code: Select all
DirectoryIndex cover.html
AddType text/x-component .htc
Options +FollowSymLinks
RewriteEngine On
RewriteBase /slush
RewriteCond %{REQUEST_URI} ^/sub(/.*)$ [NC]
RewriteRule ^/sub(/.*)$ /sub2(/.*)$1 [QSA,L]
and various combinations all giving the same 404 error:
File does not exist: P:/website/upload/slush/sub
This locked sticky post at the modrewrite forums is helpful:
http://forum.modrewrite.com/viewtopic.php?t=1445Perhaps try posting your Rewrite query on
http://forum.modrewrite.com and see if guru
richardk perhaps can suggest the correct entries for your particular needs, if you still want to use the .htaccess that is.
BTW, Apache uses Perl Compatible Regular Expressions provided by the
PCRE library - quote from the Apache Glossary under
Regular Expression (Regex)Seymour Clufley wrote:Would it be helpful if I pasted the entire httpd.conf file?
No need if you move your Alias to the httpd-xampp.conf file but I would just like to check your Alias to make sure it is OK and the one I posted should work for you - let me know how you get on please.