aebstract Posted February 19, 2008 Share Posted February 19, 2008 RewriteEngine On RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^([A-Z]+)/$ /index.php?page=$1 [NC,L] RewriteRule ^([A-Z]+)/([0-9]+)/$ /index.php?page=$1&var1=$2 [NC,L] www.berryequipment.net If you click, for example, "featured product" you'll see this url and it works: http://www.berryequipment.net/index.php?page=featured though if you go to http://www.berryequipment.net/featured/ you get a forbidden 403 error.. does anyone have any reasoning for why I'm coming up with this error? Quote Link to comment Share on other sites More sharing options...
aebstract Posted February 22, 2008 Author Share Posted February 22, 2008 This is why I didn't wanna get moved to this section of the forums. 94 views and 3 days later, no responses. Getting this issue resolved quickly! Quote Link to comment Share on other sites More sharing options...
obsidian Posted February 22, 2008 Share Posted February 22, 2008 Do you have a "featured" directory within your root? I know this seems like a basic question, but I want to be sure I know your structure. Based on the response of the browser, my guess is that you actually have a "featured" path in your web root which causes your RewriteCond to not be met, therefore, it never gets rewritten. Compare it with this: if I put http://www.berryequipment.net/index.php?page=asdf and http://www.berryequipment.net/asdf/, I get the same content. Now, your styles are not picked up in the second, but that is most likely another issue entirely. the rewrite, though, does work. Quote Link to comment Share on other sites More sharing options...
aebstract Posted February 26, 2008 Author Share Posted February 26, 2008 Cool, it wasn't working at all before, so thats a plus already. For the stylesheets, it seems that just putting a / in front of the url made it direct correctly, I'll try the same with my images and whatnot. Quote Link to comment Share on other sites More sharing options...
aebstract Posted February 26, 2008 Author Share Posted February 26, 2008 Here is my problem I am now facing: http://berryequipment.net/order/PH/ should be something similar to: http://berryequipment.net/index.php?page=order&sheet=PH The variable NAME isn't that important, its set to var1 in the code and I can change the script so it matches up with var1 instead of sheet, but why am I getting a 404 error on http://berryequipment.net/order/PH/ but I don't get one with http://berryequipment.net/order/ ? EDIT: Changed the 0-9 to A-Z and it is now working. Quote Link to comment Share on other sites More sharing options...
aebstract Posted February 27, 2008 Author Share Posted February 27, 2008 I don't think I really need a new topic for this, so I'll continue under my already on-going topic. Right now I am using this: RewriteEngine On RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^([[:alnum:]_]+)/$ /index.php?page=$1 [NC,L] RewriteRule ^([[:alnum:]_]+)/([[:alnum:]]+)/$ /index.php?page=$1&var1=$2 [NC,L] Which seems to be working for about everything. Here is the problem I have run in to and can't find a workaround for: Before I switched over to using this, I would have a url like index.php?page=blabla#line60 Which would take you to the "line60" spot on the page, wherever I set that within the page. I can I do something like this, with the clean urls? Quote Link to comment Share on other sites More sharing options...
obsidian Posted February 27, 2008 Share Posted February 27, 2008 I can I do something like this, with the clean urls? I don't know that you need to do that with mod_rewrite. It's the browser that interprets the # and anchor following, so you should be able to link to your clean URL with the anchor added: index.php/blahblah/#line60 Quote Link to comment Share on other sites More sharing options...
aebstract Posted February 28, 2008 Author Share Posted February 28, 2008 Sweet, thanks man. I didn't know where I would put the #bla in the url, if it came at the very very end regardless or if it needed to be before that /. Thank you 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.