views:

94

answers:

2

Hi, for some days now I have been trying to make a simple mod_rewrite rule to create friendly URLs, my web host have mod_rewrite enabled but I just can't get it to work.

All the next questions where posted by me:

  1. .htacces to create friendly URLs
  2. Friendly URLs with .htaccess
  3. .htacces NOT working…

None of the answers worked, so I'm thinking now using simple php routing instead and I wanted to know if there is a big performance or SEO difference between the two. And if there is, maybe you know how to fix the mod_rewrite problems posted in my questions.

Thanks.

A: 

If you're using PHP routing for PHP files only, it would be no problem performance-wise: The interpreter will get started anyway, a new process started, memory allocated etc.

But if you are planning to route requests for static resources like images and style sheets as well, however, don't use PHP routing under any circumstance. It's way too resource-intensive and not what PHP was built for.

I'd say mod_rewrite is the better, leaner solution and it's worth trying to figure it out.

Pekka
Using mod-rewrite I want to send to index.php only files with extension .php. How I do it?
Jonathan
@Jonathan well, that depends... But then, you are already in it in your other questions. There seems to be some mystery snag why it isn't working for you. I can't really offer any new insights to what has already been said there, sorry.
Pekka
A: 

I prefer routing that kicks in when the requested file doesn't exist, like this in Lighttpd:

server.error-handler-404 = "/index.php"

Provided you find out how to do this in Apache, your script would be more cross webserver compatible, since Apache's mod_rewrite conditions in .htaccess won't work on Lighttpd.

Zash
This should be used as the last straw when other things don't work IMO. With this setup, *every* page request generates a 404 that gets logged, and depending on the server software, not all environment variables from the original request are always re-routed to the 404 handler (at least in Apache).
Pekka