Forum Moderators: phranque

Message Too Old, No Replies

Apache/PHP trying to make "nice" URL's

Apache Linux OS X .htaccess mod_rewrite

         

sonnyE

6:24 pm on Jun 5, 2005 (gmt 0)

10+ Year Member



To clean up an ugly URL looking like this:
[somesite.com...]

Into this:
[somesite.com...]

This is accomplished partly in PHP using $PATH_INFO, to assign the "foldernames" (123/234/345) into an array:
$path_array = explode("/",$PATH_INFO);

This gets you some of the way, now the URL looks like:
[somesite.com...]

To get rid of the ".php" part you use a .htaccess file. And have mod_rewrite on the Apache server. This file should have permissions of the fie set to something like 777 and contain this:
<Files index>
ForceType application/x-httpd-php
</Files>

also tried:
DirectoryIndex index.php index
<Files index>
forcetype application/x-httpd-php
</Files>

It worked just fine, when I did it on a Windows box. But I moved to Mac now, and it doesn't. And the same goes with Linux. Running Apache 2.0.54 og Mac and 1.33 on Linux. I get an Apache error, on both systems:
500 Internal Server Error

I looked in the Apache error log and it said that <Files> in the .htaccess file wasn't closed. But I have closed it with </Files>. Everything should bee allright, but isn't

Any Ideas anyone?

craig1972

1:04 am on Jun 7, 2005 (gmt 0)

10+ Year Member



This is probably useless, but you could consider using the Rewrite engine instead of path info (which btw is pretty tacky way of accomplishing neat URLs).

Once Rewrite is working, just delete the path info line from your scripts. You can do a mass FIND-REPLACE through Perl if you have many scripts with that path info code.

My 2 cents.

sonnyE

6:35 am on Jun 7, 2005 (gmt 0)

10+ Year Member



thank you. But the site runs on a shared webhost. So I dont have the possibility to access the Apache configuration. Have to fix this via .htaccess

varunkrish

8:53 am on Jun 7, 2005 (gmt 0)

10+ Year Member



Error 500 as far as i know is due to a looping going indefinitely on the server which gives the server misconfiguration error 500

it can also happen due to a faulty rewrite

post ur rewrite code here (htaccess) or post if u need me to write a rule for u

just my opinion

jdMorgan

1:07 am on Jun 8, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



All I can think of is to make sure that mod_mime is loaded on the new servers. Also, make sure your code was written in plain-ASCII text and uploaded in plain-text mode. Otherwise, the message about an unclosed <Files> container just doesn't make sense.

Jim