I have seen this many sites including theScripts, that page is actually .php with some get parameter, but the page can be found at an .htm page with no get parameter.
How can that be done?
eg. If you want to see a word say girl, and the PHP page showing this word is word.php?w=girl.
I want to access the same page at girl.htm
Wikipedia does something similar.
12 1374
The only reason to do this is to make it a lot easier to add new pages. Take the following and call that word.php[php]
<?php
$newpage=$_GET['w'].'htm';
if (file_exists($newpage))
header ("location: $newpage");
else
echo "page for $_GET['w'] does not exist";
?>[/php]and this one and call that girl.htm - <body>
-
This a a girl
-
</body>
Now when I want to add a word e.g. boy, all I have to do is make some html file with the name 'boy.htm' and call it using word.php?w=boy.
The actual code in word.php is a bit more complicated, but this is a very simplified version. I have used this to allow my users to add text pages (.htm) to the site.
Was this the answer you were looking for?
Ronald
Thanks, but I want the completely opposite thing.
I mean I have a page word.php which reads the get parameter (w) and searches the database for that unique id (w) in a table, and displays the result.
So to see details of any x word, which is in the database, word.php?w=x would work.
But I want the result to be shown when the user types x.htm, instead of word.php?w=x
This is what is done in Wikipedia, and here in theScripts too. This is actually very useful to get your site in the search engine's search results.
A good familiar example is here... word.php?w=php php.htm
I believe that's a htaccess job, no? -
RewriteEngine On
-
# start engine
-
RewriteRule ^([a-zA-Z0-9])\.html$ word.php?w=$1
-
Not sure whether that is syntactically correct, but it's the right logic.
;)
Regards.
I believe that's a htaccess job, no? -
RewriteEngine On
-
# start engine
-
RewriteRule ^([a-zA-Z0-9])\.html$ word.php?w=$1
-
Not sure whether that is syntactically correct, but it's the right logic.
;)
Regards.
Even I think you are right, but need to try it first.
And dude you still didn't find a solution to that scalability issue!
Regards,
Harpreet
Even I think you are right, but need to try it first.
And dude you still didn't find a solution to that scalability issue!
Regards,
Harpreet
Ah, that's a shame.. and you call yourself an expert ;)
Regards
Ah, that's a shame.. and you call yourself an expert ;)
Regards
I can't be blamed! I'm a JS expert... you the PHP expert B-)
Regards
Harpreet
I can't be blamed! I'm a JS expert... you the PHP expert B-)
Regards
Harpreet
Have you had any luck with the .htaccess?
I must do something right!!!!!
Regards ;)
Have you had any luck with the .htaccess?
I must do something right!!!!!
Regards ;)
I didn't try it yet.
Had many other things to do. :(
Will tell you if it worked.
Regards
If you have access to the Apaches config file then all you need to do is tell Apache (assuming your server is Apache) to parse HTML files as PHP.
This is how its done: - AddType application/x-httpd-php .html
In fact you can have ANY file extension for eg. - AddType application/x-httpd-php .made_up_ext
The other way, as was mentioned earlier is .htaccess
However, you should avoid the .htaccess method as its extremely resource hungry. Thats why some shared hosting companies dont allow it to be used.
Hope this helps,
Regards
If you have access to the Apaches config file then all you need to do is tell Apache (assuming your server is Apache) to parse HTML files as PHP.
This is how its done: - AddType application/x-httpd-php .html
In fact you can have ANY file extension for eg. - AddType application/x-httpd-php .made_up_ext
The other way, as was mentioned earlier is .htaccess
However, you should avoid the .htaccess method as its extremely resource hungry. Thats why some shared hosting companies dont allow it to be used.
Hope this helps,
Regards
That isn't answering his question (although it is still interesting).
Hsriat wants the urls to be seen as one thing but be read as another, i.e. url rewriting (also know as: 'pretty urls').
regards :)
Oppsy, I see it now :)
With this rewrite concept, would you have to set a rule for every page you wish to rewrite?
Oppsy, I see it now :)
With this rewrite concept, would you have to set a rule for every page you wish to rewrite?
writing it for every page, kind of defeats the whole purpose.
what's wrong with you?
Your dancing around two issues: hiding extensions and pretty URLs.
they acomplish two different things.
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Ravi |
last post by:
My XML looks like:
<abc>
<def type="apple"> 1 </def>
<def type="peach"> 2 </def>
<def type="orange"> 3 </def>
<def type="banana"> 4 </def>
<def type="plum"> 5 </def>
</abc>
|
by: Shinin |
last post by:
I am trying to set up a mailto: link so that the actual address that
the email is being sent to is obscured and replaced by a name. For
example, I have <a href="mailto:jschmoe@abc.com">Joe...
|
by: Mason A. Clark |
last post by:
LAST WORD(s):
1. MSIE6 and Firefox will go to the top of the page on
command <a href="#top">go upsy</a> even if
there is NO name="top" or id="top"
They know what a "top" is :-)
Opera...
|
by: Umut Tezduyar |
last post by:
I know that, in asp.net 2.0, the assembly for the web site is splitted into
pieces and each time you build it, it generates a random name for assembly.
My question is, if i create a custom web...
|
by: ILoveAccess via AccessMonster.com |
last post by:
I have the following forms:
frmLeads (main form)
frmHistory (subform of frmLeads)
***************************
I want to merge the record to MS Word and to look similar to below:
Mr....
|
by: Adam Faulkner via DotNetMonster.com |
last post by:
I want to create a method within a class that opens a Microsoft Word 2000
Document and has the facility to Create a new word document and then extract
a Page that exists within the original Word...
|
by: SQL Learner |
last post by:
Hi Alex (Kuznetsov) and All,
This is to follow up with my last post, "Link two tables using partial
word match".
How can I UPDATE table using partial word match?
How can I write a SQL statement...
|
by: dave |
last post by:
Hello,
I made a function that takes a word list (one word per line, text file)
and searches for all the words in the list that are 'shifts' of
eachother. 'abc' shifted 1 is 'bcd'
Please take...
|
by: Peng Yu |
last post by:
Hi,
The following code snippet is from /usr/bin/rpl. I would like the it
to match a word, for example, "abc" in ":abc:". But the current one
would not match "abc" in ":abc:". I tried to modify...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
| |