|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
[?] work without showing '.php' extension ?
Hi,
Is it possible to make httpd.conf work without having to add .php as DirectoryIndex or application/x-httpd-php ? Here is what I'd like to have in visitors browser: http://www.my.com/script?ses=1234532&name=you - instead of - http://www.my.com/script.php?ses=1234532&name=you TIA tachyonism |
|
#2
|
|||
|
|||
|
You can change the DefaultType in httpd.conf. I'm not sure how this will effect mod_php, though.
|
|
#3
|
|||
|
|||
|
I've been looking around, but still I don't get the idea of changing the DefaultType in httpd.conf.
What should I change here ? my default is 'text/plain'. thanks for your help |
|
#4
|
||||
|
||||
|
If you have access to your htaccess file for a certain directory and change that to point at a php file (called whatever), store it in that directory, then you could have:
http://www.my.com/script/?ses=1234532&name=you with script being the directory as mentioned in the statement above. Hope this helps / is clear ?
__________________
Cheers, Jamie # mdb4u | mobile movie database | Please help to test and promote # skiFFie | Home of the 'accessibility module' for Drupal # Jamie Burns [me] Accessibility Module [drupal] # guidelines | search | wap resources | not getting help | fold to cure __________________ Let the might of your compassion arise to bring a quick end to the flowing stream of the blood and tears ..... Please hear my anguished words of truth. ![]() __________________ |
|
#5
|
||||
|
||||
|
Hi,
an alternative choice could be to use apache mod_rewrite module into your httpd.conf: Code:
RewriteEngine On RewriteRule ^/script$ /script.php [T=application/x-httpd-php,L] Doing that every request for somesite.somewhere/script?etcetc will be redirected internally ( ie "the browser does not see that" ) to somesite.somewhere/script.php?etcetc P.V. ![]() |
|
#6
|
|||
|
|||
|
Thanks for your replies.
I use pippo's way, and it works! thanks again |
|
#7
|
|||
|
|||
|
Ok... I'm going to hang my balls out there by asking a few n00b questions:
1) I have read about mod_rewrite and many posts by pippo during a mod_rewrite search of this forum. Have I understood it correctly if I say that mod_rewrite is a module of apache that lets you do rule-based URL rewriting? And: The code for mod_rewrite needs to be inserted into some file named httpd.conf? 2) What IS httpd.conf? I guess its got something to do with http and configuration ... well obviously... and that its somehow part of Apache...? I have searched for httpd.conf all over the place, but I can only find material that uses httpd.conf as if the reader knew what it was already. I also read that httpd.conf is the server context configuration, and that .htaccess is directory context configuration. I have no practical experience with apache what so ever, so my background is a bit ... sad? 3) But does this mean that while I have my website in shared hosting at some hosting company, they won't let me edit my httpd.conf? If so: How would I solve this problem then? I am asking about this because I'm trying (really hard ) to make my website mysite.com/foo/bar work its magic and load mysite.com/index.php?1=foo&2=bar
__________________
Torkil Johnsen Never underestimate the power of stupid people in large groups... ---------------------------(òÓ,)---- Last edited by torkil : May 29th, 2002 at 02:51 AM. |
|
#8
|
||||
|
||||
|
Hi,
>> Have I understood it correctly if I say that mod_rewrite is a >> module of apache that lets you do rule-based URL rewriting? Yes, these official links could help. http://httpd.apache.org/docs/mod/mod_rewrite.html http://httpd.apache.org/docs/misc/rewriteguide.html >> The code for mod_rewrite needs to be inserted into some file >> named httpd.conf? Not necessary, you can put rewrite rules inside .htaccess file too. Check this link: http://httpd.apache.org/docs/mod/mo...tml#RewriteRule and watch the context. >> What IS httpd.conf? etc etc Check this official link: http://httpd.apache.org/docs/configuring.html I usually put the rewrite rules inside the configuration file httpd.conf, because I have access to it and for perfomance issues. BTW, many people have not access to it, but to .htaccess only. >> But does this mean that while I have my website in shared >> hosting at some hosting company, they won't let me edit my >> httpd.conf? If so: How would I solve this problem then? You can use .htaccess, if your web hosting company let you. Then you can use rewrite rules inside .htaccess, if your web hosting has mod_rewrite installed. ( Last year I had the last situation, .htaccess but no rewrite rule. As mr freebsd suggested me I changed my web hosting company. Now I have a Virtual Private Server where I can edit httpd.conf directly. >>I'm trying (really hard Not so really hard In principle I used rules for redirecting mysite.com/foo/bar to mysite.com/index.php?1=foo&2=bar actually I prefer to redirect mysite.com/foo/bar to mysite.com/index.php and then use php $REQUEST_URI enviroment var to handle parameters. That said, hope this will help! ![]()
__________________
My article: mod_rewrite: No More Endless Loops! Last edited by pippo : May 29th, 2002 at 03:16 AM. |
|
#9
|
|||
|
|||
|
Okay, maybe not trying too hard. But at least I'm digging for information...
What host do you use btw? How much do you pay for hosting? What would be the practical difference between doing mod_rewrite in .htaccess and in httpd.conf? Last edited by torkil : May 29th, 2002 at 03:41 AM. |
|
#10
|
||||
|
||||
|
Hi,
we are inside php forum...so please move further apache questions to the apache forum, there you will have better assistance and that is the right place too. ![]() >>What would be the difference between doing mod_rewrite >> in .htaccess and in httpd.conf? Shortly, one main issue is perfomance. But there are for sure other reasons that I ignore, I never used .htaccess and so I can't say too much about its use and its limitations about rewrite rules. I think that if you can use httpd.conf, even if you will have to reboot apache. mod_rewrite is the name of the module. Check this document http://httpd.apache.org/docs/mod/mod_rewrite.html in particular the "API Phases". As I said, please move further questions to apache forum.... ![]() ps ( to your edited post ) do not be intimidated by "perfomance issue", we are not talking about "minardi" and "ferrari" Last edited by pippo : May 29th, 2002 at 04:08 AM. |
![]() |
| Viewing: Dev Shed Forums > System Administration > Apache Development > [?] work without showing '.php' extension ? |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|