Active TopicsActive Topics  Display List of Forum MembersMemberlist  HelpHelp   RegisterRegister  LoginLogin
Common Questions
 Helicon Tech : Common Questions
Subject Topic: Skip files or extensions in httpd.ini Post ReplyPost New Topic
Author
Message << Prev Topic | Next Topic >>
bavara
Newbie
Newbie


Joined: 20 January 2008
Online Status: Offline
Posts: 4
Posted: 20 January 2008 at 11:29am | IP Logged Quote bavara

I'm a ISAPI rewrite n00b, but am learning a lot at the moment.

I have uploaded a httpd.ini-file to the root of my server with the following code:

Code:

[ISAPI_Rewrite]

# Force a trailing slash character on folders in the browsers adressbar
RewriteCond Host: (.*)
RewriteRule ([^.?]+[^.?/]) http\://$1$2/ [I,R]

# For file-based wordpress content (i.e. theme, admin, etc.)
RewriteRule /wp-(.*) /wp-$1 [L]

# For normal wordpress content, via index.php
RewriteRule ^/$ /index.php [L]
RewriteRule /(.*) /index.php\?$1 [L]


This code enables my SEO-frienly URLs. But files like robots.txt and sitemap.xml are not reachable anymore.

My question is if it is possible to add a line to the httpd.ini, which makes *.txt, *.html and *.xml files to be directly accessible from my browser? So a line that says IIS to skip these extensions?

I hope someone can help me!
Back to Top View bavara's Profile Search for other posts by bavara
 
bavara
Newbie
Newbie


Joined: 20 January 2008
Online Status: Offline
Posts: 4
Posted: 21 January 2008 at 1:24am | IP Logged Quote bavara

No solutions?
Back to Top View bavara's Profile Search for other posts by bavara
 
Yaroslav
Moderator Group
Moderator Group


Joined: 15 August 2002
Online Status: Offline
Posts: 6449
Posted: 22 January 2008 at 6:58am | IP Logged Quote Yaroslav

This is because this last rule:

RewriteRule /(.*) /index.php\?$1 [L]

it matches just everything. It is better to modify this single rule to match only content that it is supposed to match.
Another solution to do what you ask is to add following rule at the beginning:

RewriteRule (.*\.(?:jpg|gif|css|txt|xml|html)) $1 [I,L]

Also please consider using ISAPI_Rewrite 3 which have file existance check ability to overcome this problem more gracefully.

__________________
Yaroslav Govorunov,
Helicon Tech
Back to Top View Yaroslav's Profile Search for other posts by Yaroslav Visit Yaroslav's Homepage
 
bavara
Newbie
Newbie


Joined: 20 January 2008
Online Status: Offline
Posts: 4
Posted: 22 January 2008 at 7:19am | IP Logged Quote bavara

Thanks for your reaction, Yaroslav.

In summary, the following code is your advice:

Code:

[ISAPI_Rewrite]

# Force a trailing slash character on folders in the browsers adressbar
RewriteCond Host: (.*)
RewriteRule (.*\.(?:jpg|gif|css|txt|xml|html)) $1 [I,L]
RewriteRule ([^.?]+[^.?/]) http\://$1$2/ [I,R]

# For file-based wordpress content (i.e. theme, admin, etc.)
RewriteRule /wp-(.*) /wp-$1 [L]

# For normal wordpress content, via index.php
RewriteRule ^/$ /index.php [L]
RewriteRule /(.*) /index.php\?$1 [L]


Is this true?
Back to Top View bavara's Profile Search for other posts by bavara
 
bavara
Newbie
Newbie


Joined: 20 January 2008
Online Status: Offline
Posts: 4
Posted: 22 January 2008 at 8:21am | IP Logged Quote bavara

Or can You tell me how I can modify the single rule to match only content that is supposed to match, instead of the current rule that matches everything?
Back to Top View bavara's Profile Search for other posts by bavara
 
Yaroslav
Moderator Group
Moderator Group


Joined: 15 August 2002
Online Status: Offline
Posts: 6449
Posted: 23 January 2008 at 5:09am | IP Logged Quote Yaroslav

[ISAPI_Rewrite]

# Force a trailing slash character on folders in the browsers adressbar
RewriteCond Host: (.*)
RewriteRule ([^.?]+[^.?/]) http\://$1$2/ [I,R]

RewriteRule (.*\.(?:jpg|gif|css|txt|xml|html)) $1 [I,L]

# For file-based wordpress content (i.e. theme, admin, etc.)
RewriteRule /wp-(.*) /wp-$1 [L]

# For normal wordpress content, via index.php
RewriteRule ^/$ /index.php [L]
RewriteRule /(.*) /index.php\?$1 [L]

__________________
Yaroslav Govorunov,
Helicon Tech
Back to Top View Yaroslav's Profile Search for other posts by Yaroslav Visit Yaroslav's Homepage
 
smcguinness
Newbie
Newbie


Joined: 30 April 2008
Online Status: Offline
Posts: 2
Posted: 30 April 2008 at 4:27pm | IP Logged Quote smcguinness

is there anyway to use the trailing slash rewriterule while still maintaining an ip with port?

xxx.xx.xxx:xxxx/directory -> xxx.xx.xxx:xxxx/directory/

Thanks.
Back to Top View smcguinness's Profile Search for other posts by smcguinness
 
Lexey
Moderator Group
Moderator Group


Joined: 15 August 2002
Location: Russian Federation
Online Status: Offline
Posts: 7389
Posted: 01 May 2008 at 3:54pm | IP Logged Quote Lexey

The given rule preserves both host name and port.
Back to Top View Lexey's Profile Search for other posts by Lexey
 

If you wish to post a reply to this topic you must first login
If you are not already registered you must first register

  Post ReplyPost New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum