Page is a not externally linkable
- Code, Content, and Presentation
-- Apache Web Server
---- Rewrite .php extension to virtual folder


g1smd - 12:24 pm on Feb 22, 2010 (gmt 0)


Rewrite: example.com/english/news (URL) => /english/index.php (internal filepath)

RewriteRule ^english/news/$ /english/news.php [L]


More general pattern would be:

RewriteRule ^([^/]+)/([^/]+)/$ /$1/$2.php [L]

Personally, I would NOT use a trailing slash on these URLs. I would use 'extensionless' /english/news instead.

You also need to add the redirect from .php URLs (and it should redirect for both www and non-www) to extensionless URLs (and it should force www for those requests in the same redirect).


Thread source:: http://www.webmasterworld.com/apache/4084680.htm
Brought to you by WebmasterWorld: http://www.webmasterworld.com