Hello all,
Thanks for all your responses...
The thing I do on apache is a very common trick which is quite easy to
set up. I'm not sure it has to be so difficult on IIS (at least, I hope
so)
It doesn't really have a functional purpose, it can only make the URL
more attractive or easier to use.
This is the code I need to put into .htaccess file :
<IfModule mod_rewrite.c>
Options +FollowSymlinks
RewriteEngine on
RewriteRule ^(.*)\.html$ index.php?setpage=$1 [nc]
</IfModule>
Result: each *.html request in the URL is "translated" discretely into
index.php?setpage=pagename
In my case, index.php processes CMS-based pages and opens the page with
the name "pagename"
I works as good without the htaccess code, but you'll get this in the
URL :
http://www.domain.com/index.php?setpage=aboutus http://www.domain.com/index.php?setpage=contactus http://www.domain.com/index.php?setpage=guestbook
Using the rewrite rule, the URL looks like this :
http://www.domain.com/aboutus.html http://www.domain.com/contactus.html http://www.domain.com/guestbook.html
I'll give another example :
Take for example:
http://www.php.net/strptime
You might think that the webbrowser has a directory "strptime" which
responds, but in reality it's the "rewrite rule" which converts the URL
discretely into
http://be2.php.net/manual/en/function.strptime.php
Result : If I need the reference page of the strlen-function in PHP, I
know I can type "php.net/strlen" and I don't need to type
be2.php.net/manual/en/function.strlen.php.
Yet another example :
http://www.hotscripts.com/Detailed/50145.html
hotscripts is a databasedriven website, so I presume they don't need to
create a .html file for each item in the database. The above URL is
probably translated into something like : detail.php?item=50145.
I'm using a commercial webhosting server, and I don't think I can
access the settings for 404 errors. I was hoping IIS has a similar way
for doing URL rewriting...
Kind regards, and Happy newyear !
Mathew
Evertjan. schreef:
Mark McGinty wrote on 01 jan 2007 in
microsoft.public.inetserver.asp.general:
========http://www/mypage.html ============
<% ' vbscript
response.redirect "/page2.php?page=mypage"
%>
===========================================
What exactly would you expect this to do in an .HTML file?
Unless you
mapped the .html extension to asp.dll, to process files with that
extension as server-side script, the correct answer would be
"nothing".
True. My mistake, read: http://www.??.??/mypage.asp
IIS can remap [about?] any extention to be read by the asp interpreter.
============= /404.asp ====================
<%
qstr = lcase(Request.ServerVariables("QUERY_STRING"))
if instr(qstr,":80/virtualdir/")>0 then
session("qstr")=qstr
server.transfer "/anydirectory/page.php"
[..]
The .php, could be anything, I prefer page.asp
end if
%>
However, my real [in my view] answer was this use of 404.asp.
The extention of the nonexisitng [=virtual] pages does not matter here,
the asp interpereater is always "on".
The page.asp could be something like this:
[on my site, even Google sees this page as 110 different ones]
=========== /anydirectory/page.asp ================
<html>
<head>
....
</head>
<body>
<% if instr(session("qstr"),"/virtualdir/xxx.html")>0 then %>
<b>This</bis the content of xxx .............
<% elseif instr(session("qstr"),"/virtualdir/blah.qrs")>0 then %>
<b>This</bis the content of blah .............
<% elseif instr(session("qstr"),"/virtualdir/otherext.asp")>0 then %>
<b>This</bis the content of <%=session("qstr")%>:
.............
<% else %>
Page not found [404]
</body>
</html>
<%
session("qstr") = ""
response.end
end if
session("qstr") = ""
%>
<br>General footer [except for not found 404] .........
</body>
</html>
================================================== ===
To make it really perfect, you would have to make dynamic headers
of the 200 and 404 kind.
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)