| Author |
|
bavara Newbie

Joined: 20 January 2008
Online Status: Offline Posts: 4
|
| Posted: 20 January 2008 at 11:29am | IP Logged
|
|
|
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
Online Status: Offline Posts: 4
|
| Posted: 21 January 2008 at 1:24am | IP Logged
|
|
|
No solutions?
|
| Back to Top |
|
| |
Yaroslav Moderator Group

Joined: 15 August 2002
Online Status: Offline Posts: 6449
|
| Posted: 22 January 2008 at 6:58am | IP Logged
|
|
|
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 |
|
| |
bavara Newbie

Joined: 20 January 2008
Online Status: Offline Posts: 4
|
| Posted: 22 January 2008 at 7:19am | IP Logged
|
|
|
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
Online Status: Offline Posts: 4
|
| Posted: 22 January 2008 at 8:21am | IP Logged
|
|
|
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 Moderator Group

Joined: 15 August 2002
Online Status: Offline Posts: 6449
|
| Posted: 23 January 2008 at 5:09am | IP Logged
|
|
|
[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 |
|
| |
smcguinness Newbie

Joined: 30 April 2008
Online Status: Offline Posts: 2
|
| Posted: 30 April 2008 at 4:27pm | IP Logged
|
|
|
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
Online Status: Offline Posts: 7389
|
| Posted: 01 May 2008 at 3:54pm | IP Logged
|
|
|
The given rule preserves both host name and port.
|
| Back to Top |
|
| |