Turn on suggestions
Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.
Showing results for
More mod_rewrite questions (normal webspace not ccgi)
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Plusnet Community
- :
- Forum
- :
- Help with my Plusnet services
- :
- Everything else
- :
- More mod_rewrite questions (normal webspace not cc...
More mod_rewrite questions (normal webspace not ccgi)
16-03-2008 12:32 PM
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Report to Moderator
OK so I'm trying to make a more advanced mod_rewrite configuration, and I'm experiencing a few false starts. For example I'd really like to use "Rewritecond" with the
%{REQUEST_FILENAME} variable and -f option as I've read that I can make it check for a file and only carry out the rewrite if the file exists.
Unfortunately the path in %{REQUEST_FILENAME} is much longer than the path in the url, it seems to be the absolute path, and as such I can't use tests like
Rewritecond images/%{REQUEST_FILENAME} -f
as %{REQUEST_FILENAME} expands to something like /share/isp/plusnet/www/bu ... and so on
Update...I think this is holding now,
I've changed the Rewritecond to something like
Rewritecond /share/isp/plusnet/allthatstuff/$1 -f
and it seems to work, even though the $1 substitution appears before the expression that uses it.
It still needs some work as the pattern match is a bit squirrely still but its working so it appears that I can have files served from two or more locations
Extracting the full pathname to your webspace is tricky but I found a rule like
RewriteRule ^/?aardvark\.htm /index.htm?%{REQUEST_FILENAME} [L,R]
caused it to be written to the address bar where I could see it.
%{REQUEST_FILENAME} variable and -f option as I've read that I can make it check for a file and only carry out the rewrite if the file exists.
Unfortunately the path in %{REQUEST_FILENAME} is much longer than the path in the url, it seems to be the absolute path, and as such I can't use tests like
Rewritecond images/%{REQUEST_FILENAME} -f
as %{REQUEST_FILENAME} expands to something like /share/isp/plusnet/www/bu ... and so on
Update...I think this is holding now,
I've changed the Rewritecond to something like
Rewritecond /share/isp/plusnet/allthatstuff/$1 -f
and it seems to work, even though the $1 substitution appears before the expression that uses it.
It still needs some work as the pattern match is a bit squirrely still but its working so it appears that I can have files served from two or more locations
Extracting the full pathname to your webspace is tricky but I found a rule like
RewriteRule ^/?aardvark\.htm /index.htm?%{REQUEST_FILENAME} [L,R]
caused it to be written to the address bar where I could see it.
Message 1 of 2
(854 Views)
1 REPLY 1
Re: More mod_rewrite questions (normal webspace not ccgi)
27-03-2008 8:28 AM
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Report to Moderator
Can anyone help with writing a regular expression...
I'd like to match filenames that are in the root and don't have an extension.
I think something like /?([^/.]+) might do it, or maybe I need to use a negated Rewritecond rule to say if the name does have a dot in then don't execute the rule.
Somehow any expression I write ending in $ fails to match anything. Do urls have a trailing character after the filename that prevents match-to-eol?
I'd like to match filenames that are in the root and don't have an extension.
I think something like /?([^/.]+) might do it, or maybe I need to use a negated Rewritecond rule to say if the name does have a dot in then don't execute the rule.
Somehow any expression I write ending in $ fails to match anything. Do urls have a trailing character after the filename that prevents match-to-eol?
Message 2 of 2
(186 Views)
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Plusnet Community
- :
- Forum
- :
- Help with my Plusnet services
- :
- Everything else
- :
- More mod_rewrite questions (normal webspace not cc...