I'm really really new to this, and have worked a lot of things out myself, but basically I have quite a few rules, all of which work, but now I'm getting into deeper stuff with more variables and my lack of knowledge is starting to show through this!

First quick thing, because some users type in the url they sometimes miss out the last slash, so like http://www.daniweb.com/account or http://www.daniweb.com/account/ I've created 2 rules to cover this, is that right? Just wondering because with 1 pages it's ok but with multiple pages it fills the htaccess file big time!

Secondly, right, this is the rule:

RewriteRule ^account/(.*)/(.*)$ account.php?p=$1&p2=$2

Some of you might spot what's wrong straight away but bare with me! It looks right to me, but I had a if statement etc for the url variables and it wasn't working, so I echoed back each of the variables, and it's only returning the first variable, and that first variable is showing like this: settings/personal (example url: http://daniweb.com/account/settings/personal

Anyone possibly show me what I've done wrong please!?

7 Years
Discussion Span
Last Post by nileshgr

.htaccess is going to turn big if you do it this way.
Rewrite all non-existant paths to a PHP script which will resolve the URL.

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule (.*) index.php

Then in the PHP script explode('/', $_SERVER) and use the array to process the path.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.