rickythakrar Posted May 17, 2007 Share Posted May 17, 2007 I will attempt to present the problem in the simplest way possible. Desired result (to work dynamically with any string) URL address bar physical page home home/ domain.com/index.php?x=home home/ home/ domain.com/index.php?x=home images/logo.gif images/logo.gif images/logo.gif The rules in words 1. Where there is a slash at the end, redirect [working] 2. Where there is no slash or dot in the URI, add a trailing slash 3. Where there isn't a file or directory existing, redirect Working 1. RewriteRule ^(.+)/$ http://findanecohome.co.uk/index.php?x=$1 [nc,qsa] Attempts 2. RewriteRule ^((.+)!\.(.+))/$ http://findanecohome.co.uk/$1/ [nc,r,qsa] 3. RewriteCond %{REQUEST_URI} !-f RewriteCond %{REQUEST_URI} !-d RewriteCond ^(.+)$ http://findanecohome.co.uk/index.php?x=$1 [nc,qsa] Quote Link to comment Share on other sites More sharing options...
rickythakrar Posted May 17, 2007 Author Share Posted May 17, 2007 Gargh! You work on something for two days, post it on a forum and work it out 5 minutes later. *sigh* Anyway, this is the final solution: RewriteRule ^([A-Za-z0-9-]+)$ http://domain.co.uk/$1/ [are,l,nc,qsa] RewriteRule ^([A-Za-z0-9-]+)/$ http://domain.co.uk/index.php?x=$1 [l,nc,qsa] I think it meets all the rules. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.