clean url problem .htaccess

clean url problem .htaccess

am 01.08.2009 08:11:58 von blueman

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 :

ForceType application/x-httpd-php

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: clean url problem .htaccess

am 01.08.2009 08:52:00 von Andrew Ballard

On Sat, Aug 1, 2009 at 2:11 AM, A.a.k wrote:
> Hi
> I'm trying to use clean urls in my application:
> lets say convert http://mysite/article.php?id=3D3   to
> http://mysite/article/3/
> my problem is to use /article act as it was /article.php
> here is mt .htacess :
>
> ForceType application/x-httpd-php
>

> 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: clean url problem .htaccess

am 01.08.2009 10:13:11 von blueman

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" wrote in message
news:b6023aa40907312352j405778fevd0c38315c3983f0c@mail.gmail .com...
On Sat, Aug 1, 2009 at 2:11 AM, A.a.k 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 :
>
> ForceType application/x-httpd-php
>

> 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: clean url problem .htaccess

am 01.08.2009 16:01:54 von 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: clean url problem .htaccess

am 01.08.2009 18:34:23 von olavell

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: clean url problem .htaccess

am 01.08.2009 22:30:24 von HallMarc Websites

> -----Original Message-----
> From: A.a.k [mailto:blueman@gmail.com]
> Sent: Saturday, August 01, 2009 4:13 AM
> To: php-general@lists.php.net
> Subject: Re: [PHP] clean url problem .htaccess
>=20
> 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.
>=20
>=20
> "Andrew Ballard" wrote in message
> news:b6023aa40907312352j405778fevd0c38315c3983f0c@mail.gmail .com...
> On Sat, Aug 1, 2009 at 2:11 AM, A.a.k wrote:
> > Hi
> > I'm trying to use clean urls in my application:
> > lets say convert http://mysite/article.php?id=3D3 to
> > http://mysite/article/3/
> > my problem is to use /article act as it was /article.php
> > here is mt .htacess :
> >
> > ForceType application/x-httpd-php
> >

> > 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?
> >
>=20
> Look up mod_rewrite.
>=20
> 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




=20

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

The message was checked by ESET Smart Security.

http://www.eset.com
=20


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

RE: clean url problem .htaccess

am 01.08.2009 22:41:46 von HallMarc Websites

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

=20
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
=20

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

The message was checked by ESET Smart Security.

http://www.eset.com
=20


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