This forum has been moved here:
Helicon Tech Community Forum

  Active TopicsActive Topics  Display List of Forum MembersMemberlist  HelpHelp   RegisterRegister  LoginLogin
Common Questions (Forum Locked Forum Locked)
 Helicon Tech : Common Questions
Subject Topic: Skip files or extensions in httpd.ini (Topic Closed Topic Closed)
Author
Message |
bavara
Newbie


Joined: 20 January 2008
Posts: 4
Posted: 20 January 2008 at 11:29am  

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
 
bavara
Newbie


Joined: 20 January 2008
Posts: 4
Posted: 21 January 2008 at 1:24am  

No solutions?
Back to Top
 
Yaroslav
Admin Group


Joined: 15 August 2002
Posts: 6520
Posted: 22 January 2008 at 6:58am  

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 Visit Yaroslav's Homepage
 
bavara
Newbie


Joined: 20 January 2008
Posts: 4
Posted: 22 January 2008 at 7:19am  

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
 
bavara
Newbie


Joined: 20 January 2008
Posts: 4
Posted: 22 January 2008 at 8:21am  

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
 
Yaroslav
Admin Group


Joined: 15 August 2002
Posts: 6520
Posted: 23 January 2008 at 5:09am  

[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 Visit Yaroslav's Homepage
 
smcguinness
Newbie


Joined: 30 April 2008
Posts: 2
Posted: 30 April 2008 at 4:27pm  

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
 
Lexey
Moderator Group


Joined: 15 August 2002
Location: Russian Federation
Posts: 8119
Posted: 01 May 2008 at 3:54pm  

The given rule preserves both host name and port.
Back to Top
 

Sorry, you can NOT post a reply.
This forum has been locked by a forum administrator.

Printable version Printable version
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