This is a discussion on Quick mod_rewrtie quesyion within the Coding Help forums, part of the Webmaster Help category; Thought it was something like that, hence the request. Glad you got it sorted...
| |||||||
| Register | Forum Rules | FAQ | Donate | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| |||||
| Thought it was something like that, hence the request. Glad you got it sorted
__________________ PHP Code: |
| ||||
| Do you still need a hand with this? I've done it recently on a site.
__________________ David Behan Web Design | Mortgages | Memorial Websites | Digital Printing | Golf Holidays Portugal | Conservatories |
| |||||
| Quote:
Any ideas how to get around this? |
| ||||
| You can add a condition to your rule like this: RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_URI} !^/(forum)/.*$ RewriteRule ^([a-z0-9/-]+)$ inner.asp?p=$1 [NC,L] First line checks that a file doesn't actually exist, second a directory doesn't exist, third the URL doesn't start with forum, and last line (if all conditions above are false) executes the rewrite. I suspect you just need to add the third line to your code in the same format as above. HTH Dave |
| |||||
| 3 ways to do it 1. daves way 2. add this to the top of you .htaccess Code: RewriteRule ^/?(forum)/$ forum/index.php [L] Another helpful rule is Code: # # ONLY FOR TESTING REWRITE RULES!!!!! # RewriteLog "/tmp/rewrite.log" RewriteLogLevel 5 |
| ||||
| Quote:
Good to have a bit of lateral thinking of a solution though. Thanks for the log file code - that would have been handy recently when I was debuging what the hell htaccess was doing! Rgds, Dave |
| |||||
| That worked a treat, thanks lads. One another note while i have you here, any suggestions why mod_rewrite wont work at home on my test machine? |
| ||||
| You're probably developing on a windows machine. Only way to use htaccess on windows is to use ISAPI_Rewrite - URL Rewrite engine for IIS, ISAPI Filter for URL Rewriting, mod_rewrite for IIS. I use it on my live server for developing in asp. |
| |||||
| Quote:
|
| |||||
| Ziycon if you are running apache on xp there should not be a problem make sure mod rewrite is enabled in apache. I test using xampp on my xp machine and have no problem testing mod rewrite. David my first one (no.2) should work as expected and leave the url as mysite.com/forum/ the same as with any other rule it doesn't add index.php, not sure why you thought it would. The 3rd does have that obvious disadvantage but without knowing his forum setup it may the easiest way so its good to have it as an option, lateral thinking as you say. Saying that I think your solution is the best one and would be the recommended one by me too. |
| Tags |
| modrewrtie, quesyion, quick |
| Thread Tools | |
| Display Modes | |
|
|
| ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| A quick plug! | EdenWeb | Off topic discussion | 3 | 29-01-2008 11:09 PM |
| resizing the quick reply box | paul | Forum Feedback, Development and Competitions | 6 | 15-01-2008 03:57 PM |
| Quick question Re:pr | kjt | Search Engine Optimisation | 8 | 08-11-2007 12:26 PM |
| Another quick review... | davidbehan | Site Reviews / Announcements | 18 | 03-06-2007 07:46 PM |
| A quick review | louie | Site Reviews / Announcements | 5 | 25-02-2007 01:30 AM |
| ||||||||
| | ![]() | |||||||