[suPHP] No search engine friendly URLs anymore?
Jeremy Chadwick
suphp at jdc.parodius.com
Tue May 6 14:56:54 CEST 2008
On Tue, May 06, 2008 at 01:45:12PM +0200, Christian Scholz-Flöter wrote:
> Hi there,
>
> my web hosting provider has recently switched to suPHP.
> Before that day, I used to let the server re-write URLs to make them
> search engine friendly.
> The following was the .htacess file I'd used successfully to achieve
> URLs like
> "http://www.christianscholz.com/articles/lass-deine-user-bezahlen":
>
> <Files topics>
> ForceType application/x-httpd-php
> </Files>
> <Files articles>
> ForceType application/x-httpd-php
> </Files>
This is a very bizare .htaccess, if you ask me. <Files> is supposed to
be used to refer to actual files/filenames, not directories or pieces of
a directory. There's <Directory> for that, and <Location> (which is
probably what you're wanting). But <Directory> and <Location> cannot be
used within an .htaccess -- however, Rewrite can be.
You probably have directories on the filesystem called /articles/ and
/topics/, and inside each you have an index.php file which is doing the
URL re-writing for you. The PHP script is examining the REQUEST_URI
environment variable, or something very similar to that, and does some
magic to map it to something internal that will return results for what
you want.
ForceType is forcing the MIME type of all files within those directories
to be application/x-httpd-php, and I don't understand why this is being
used, unless your hosting provider gives you the opportunity to "opt-in"
to using suPHP.
> Unfortunately, this does not work anymore. My provider's advice to leave
> out "application/" did not improve the situation much.
If your provider is recommending this, they have no idea what they're
doing. The MIME type you give ForceType needs to match *exactly* what
your hosting providers' AddHandler or suPHP_AddHandler lines are.
If they use suPHP 0.5.x, they should be using this:
AddType application/x-httpd-php .php
AddHandler x-httpd-php .php
If they use suPHP 0.6.x, they should be using this:
AddType application/x-httpd-php .php
suPHP_AddHandler application/x-httpd-php
The reason the AddHandler line lacks the "application/" part is because
suPHP 0.5.x is hard-coded to use "x-httpd-php". suPHP 0.6.x lets you
properly pick what you want, using the suPHP_AddHandler directive.
> Does anyone have a similar situation or, better yet, know how to use
> suPHP AND create search engine friendly URLs?
I don't see what suPHP has to do with re-writing URLs. There's nothing
about suPHP which stops a PHP script from running when an HTTP request
is received, and mapping something "simple" like "foo-bar-blat" into
something internally like "blah.php?name=foo%20bar%20blat".
For example, we host a user who uses WordPress, and he uses this
feature. He has no problems, and we use suPHP.
Bottom line: you need to work this out with your hosting provider, or
pick one who offers what it is you need.
--
| Jeremy Chadwick jdc at parodius.com |
| Parodius Networking http://www.parodius.com/ |
| UNIX Systems Administrator Mountain View, CA, USA |
| Making life hard for others since 1977. PGP: 4BD6C0CB |
More information about the suPHP
mailing list