Using this I can remove .php from all my URL's so www.example.com/index.php now works as www.example.com/index which is great. I have updated my linking schema on the site so I now use the URL's with the extension removed.
This works great for 80% of pages except when I have to pass a variable into the URL such as www.example.com/edit_user.php?id=5. If I try www.example.com/edit_user?id=5 it gives a 404 error so how do I deal with this? At the moment I am having to use the full URL which I would rather not do as it is inconsistent and ideally I would like to be able to use something like www.example.com/edituser/id/5 - is that possible?
Remember, a rewrite does NOT "make URLs for your content". Instead, the server accepts a URL request and if the path part of the URL matches the RegEx pattern, then the rewrite fires to fetch the content from somewhere inside the server.
In plain English, the left side attempts to match the requested URL and the right side is the internal server location where the content really resides.
Msg#: 4271226 posted 12:52 pm on Feb 25, 2011 (gmt 0)
Got you now - so instead of doing this is my root htaccess file I add this to the htaccess in the folder in question so the left part is always local to that file and the right part is the whole path?
I assume in this case whatever is in the web root htaccess still applies even if I put a new one in a sub directory? i.e. the new file in the subdirectory complements the web root one rather than replaces it?
This works fine - all pages redirect to https, extension is removed and when anyone tries /app/user or /app/user/index.php it redirects to /app/user/user.
If I add this line "RewriteRule ^edituser/([0-9]+) /users/edit_user.php?id=$1 [L]" into the root htaccess it gives me 500 Internal Server Error.
If I put it into the /app/user directory I can get the url to work i.e. /app/user/user-edit/5 allows me to edit user 5 BUT then the app/user/index.php redirect stops working.
Assume I need to get all the redirects for that directory into the one htaccess file located there?
Have tried all variations I can think of including variations of RewriteBase and changing the paths in the actual ReWriteRule but cant get them to co-exist, can they be made to work in conjunction with each other?