[PHP] clean url problem .htaccess

2009-08-01 Thread A.a.k

Hi
I'm trying to use clean urls in my application:
lets say convert http://mysite/article.php?id=3   to 
http://mysite/article/3/

my problem is to use /article act as it was /article.php
here is mt .htacess :
FilesMatch ^article$
ForceType application/x-httpd-php
/FilesMatch
on php code parsing string from $_SERVER['PHP_SELF'] to get id out.

this one works if i use article.php (http://mysite/article.php/3/ works)
but i want to use /article without php extention. is there a way around? 



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] clean url problem .htaccess

2009-08-01 Thread Andrew Ballard
On Sat, Aug 1, 2009 at 2:11 AM, A.a.kblue...@gmail.com wrote:
 Hi
 I'm trying to use clean urls in my application:
 lets say convert http://mysite/article.php?id=3   to
 http://mysite/article/3/
 my problem is to use /article act as it was /article.php
 here is mt .htacess :
 FilesMatch ^article$
 ForceType application/x-httpd-php
 /FilesMatch
 on php code parsing string from $_SERVER['PHP_SELF'] to get id out.

 this one works if i use article.php (http://mysite/article.php/3/ works)
 but i want to use /article without php extention. is there a way around?


Look up mod_rewrite.

Andrew

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] clean url problem .htaccess

2009-08-01 Thread A.a.k
what if I don't have access to server to enable mod_rewrite like a hosting, 
is there anyway to work around?
just don't want to build entire website and finally can't get a hosting to 
enable mod_rewrite for me.



Andrew Ballard aball...@gmail.com wrote in message 
news:b6023aa40907312352j405778fevd0c38315c3983...@mail.gmail.com...

On Sat, Aug 1, 2009 at 2:11 AM, A.a.kblue...@gmail.com wrote:

Hi
I'm trying to use clean urls in my application:
lets say convert http://mysite/article.php?id=3 to
http://mysite/article/3/
my problem is to use /article act as it was /article.php
here is mt .htacess :
FilesMatch ^article$
ForceType application/x-httpd-php
/FilesMatch
on php code parsing string from $_SERVER['PHP_SELF'] to get id out.

this one works if i use article.php (http://mysite/article.php/3/ works)
but i want to use /article without php extention. is there a way around?



Look up mod_rewrite.

Andrew 



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] clean url problem .htaccess

2009-08-01 Thread kranthi
mod_rewrite is the best solution available to your case. more over if
you are sure that your host supports .htaccess, there is very little
chance that they will block mod rewrite alone. you can confirm that by
phpinfo. look in apache2handler- Loaded Modules  section (this does
not tell you if .htaccess is enabled/disabled)

but in the worst case try using $_SERVER['REQUEST_URI'] instead of
$_SERVER['PHP_SELF'].

in either case you cannot do this with .htaccess disabled.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] clean url problem .htaccess

2009-08-01 Thread O. Lavell
A.a.k wrote:

 what if I don't have access to server to enable mod_rewrite like a
 hosting, is there anyway to work around?

No.

 just don't want to build entire website and finally can't get a hosting
 to enable mod_rewrite for me.

Then make it a requirement when you are choosing a (shared) hosting 
provider. 


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] clean url problem .htaccess

2009-08-01 Thread HallMarc Websites
 -Original Message-
 From: A.a.k [mailto:blue...@gmail.com]
 Sent: Saturday, August 01, 2009 4:13 AM
 To: php-general@lists.php.net
 Subject: Re: [PHP] clean url problem .htaccess
 
 what if I don't have access to server to enable mod_rewrite like a
 hosting,
 is there anyway to work around?
 just don't want to build entire website and finally can't get a hosting
 to
 enable mod_rewrite for me.
 
 
 Andrew Ballard aball...@gmail.com wrote in message
 news:b6023aa40907312352j405778fevd0c38315c3983...@mail.gmail.com...
 On Sat, Aug 1, 2009 at 2:11 AM, A.a.kblue...@gmail.com wrote:
  Hi
  I'm trying to use clean urls in my application:
  lets say convert http://mysite/article.php?id=3 to
  http://mysite/article/3/
  my problem is to use /article act as it was /article.php
  here is mt .htacess :
  FilesMatch ^article$
  ForceType application/x-httpd-php
  /FilesMatch
  on php code parsing string from $_SERVER['PHP_SELF'] to get id out.
 
  this one works if i use article.php (http://mysite/article.php/3/
 works)
  but i want to use /article without php extention. is there a way
 around?
 
 
 Look up mod_rewrite.
 
 Andrew


Have you checked to see if you hosting environment allows custom php.ini files? 
If so, then ask them for information that governs their setup on your server.


Thank you,
Marc Hall
HallMarc Websites
610.446.3346




 

__ Information from ESET Smart Security, version of virus signature 
database 4296 (20090801) __

The message was checked by ESET Smart Security.

http://www.eset.com
 


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] clean url problem .htaccess

2009-08-01 Thread HallMarc Websites
 -Original Message-
 From: O. Lavell [mailto:olav...@xs4all.nl]
 Sent: Saturday, August 01, 2009 12:34 PM
 To: php-general@lists.php.net
 Subject: Re: [PHP] clean url problem .htaccess
 
 A.a.k wrote:
 
  what if I don't have access to server to enable mod_rewrite like a
  hosting, is there anyway to work around?
 
 No.
 
  just don't want to build entire website and finally can't get a
 hosting
  to enable mod_rewrite for me.
 
 Then make it a requirement when you are choosing a (shared) hosting
 provider.
 
 

 
Meh, there is that! Find a host that has requirements you are looking for. 
Which reminds me... I do allow this in my hosting packages.

Marc Hall
HallMarc Websites
610.446.3346
 

__ Information from ESET Smart Security, version of virus signature 
database 4296 (20090801) __

The message was checked by ESET Smart Security.

http://www.eset.com
 


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php