PDA

View Full Version : Modx .htaccess equivalent


tazzydemon
11-11-2009, 10:15 AM
Dear All

The modx .htaccess file contains this friendly url code:

# The Friendly URLs part
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]

The last line is achieved with this resin code:

<rewrite-dispatch>
<dispatch regexp="\.(php|gif|css|jpg|png|ico|js|html|htm|txt)"/>
<forward regexp="^/" target="/index.php?q="/>
</rewrite-dispatch>
<welcome-file-list><welcome-file>index.php</welcome-file></welcome-file-list>

However I cannot see how to test for existing files or directories in the two previous conditions using the resin rewrite code.

HELP!!

Julian

emil
11-11-2009, 07:39 PM
Hi Julian,

Looks like you're emulating the behavior somewhat with your rules, which may work fine for modx. To get the exact same behavior, you'll need to convert to Resin 4.0 rewrite rules (you're using Resin 3.1 syntax). In Resin 4.0, there's a <resin:IfFileExists/> tag that does what you're looking for. There's a similar example here for WordPress (http://wiki.caucho.com/Rewrite_WordPress) on our wiki.

Best,
Emil

tazzydemon
11-12-2009, 09:22 AM
That perhaps illustrates another point. The website is a bit disorganised and its hard to be sure exactly what you are reading and what its pertinent to, but thanks for the tip.

Julian