User Friendly URLS

software development

#1

So, i’ve been trying to convert my site to use the so called “user-friendly URLS” (URLS without any extensions or any visible queries ?=& etc). I came across a few sites that showed how to achieve this by using apache’s ForceType directive like this.

<Files ~ ^(id|browse|tags|admintags|submitid|info)$>
ForceType application/x-httpd-php
</Files>

This seems to do the trick but now my php scripts are running via the apache module rather than cgi. This is a problem with some of my scripts where I need write access to some of my files.
Is there any alternative to using the apache forcetype directive.


#2

That’s a terrible way to do this. Look into using mod_rewrite instead. I’ve never even heard of using ForceType for this.


If you want useful replies, ask smart questions.


#3

Yeah, i thought mod rewrite would be a better way to do this. You’ve never heard of using forectype for this? Google user-friendly urls. There are numerous sites that explain how to use this very method. What’s wrong with using this method?

Sites I found while doing research on google.
http://www.evolt.org/article/Search_Engine_Friendly_URLs_with_PHP_and_Apache/17/15049/index.html"
http://www.zend.com/zend/trick/tricks-apr-2003-urls.php
http://www.tutorio.com/tutorial/php-alternative-to-mod-rewrite-for-se-friendly-urls
http://agachi.name/weblog/archives/2005/01/30/rewriting-dynamic-urls-into-friendly-urls.htm

HERE IS MY SOLUTION…

RewriteEngine on
RewriteRule ^(browse|(admin)?tags|(submit)?id|info)/(.*) $1.php/$2


#4

Frameworks.

Look into MVC design patterns. It’s the same one that Ruby (Rails) uses as well as CakePHP (for PHP) as well as the Zend Framework.


www.zendframework.com (a bit more advanced)


yerba# rm -rf /etc
yerba# _