Irish SEO,  Marketing & Webmaster Discussion

 

Quick mod_rewrtie quesyion

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...


Go Back   Irish SEO, Marketing & Webmaster Discussion > Webmaster Help > Coding Help

Register Forum Rules FAQDonate Members List Calendar Search Today's Posts Mark Forums Read


Notices

Reply

 

LinkBack Thread Tools Display Modes
  #11 (permalink)  
Old 25-02-2008, 07:52 PM
Frodo's Avatar
Ciaran Rooney - Weeno Ltd
 
Join Date: Jan 2007
Location: London
Posts: 359
Nominated 0 Times in 0 Posts
TOTW/F/M Award(s): 0
Frodo has much to be proud ofFrodo has much to be proud ofFrodo has much to be proud ofFrodo has much to be proud ofFrodo has much to be proud ofFrodo has much to be proud ofFrodo has much to be proud ofFrodo has much to be proud ofFrodo has much to be proud of
Send a message via MSN to Frodo Send a message via Skype™ to Frodo
Default

Thought it was something like that, hence the request. Glad you got it sorted
__________________
PHP Code:
print "CEO Weeno Ltd   - http://www.weeno.ie";
print 
"CTO Skimbit Ltd - http://skimbit.com"
skimlinks.com :: Outsource your affiliate marketing and generate revenue from your content easily.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #12 (permalink)  
Old 25-02-2008, 08:06 PM
Hardcore Geek
 
Join Date: Nov 2006
Location: Navan, Meath
Posts: 566
Nominated 0 Times in 0 Posts
TOTW/F/M Award(s): 0
davidbehan is a name known to alldavidbehan is a name known to alldavidbehan is a name known to alldavidbehan is a name known to alldavidbehan is a name known to alldavidbehan is a name known to all
Send a message via Skype™ to davidbehan
Default

Do you still need a hand with this? I've done it recently on a site.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #13 (permalink)  
Old 26-02-2008, 12:27 AM
ziycon's Avatar
Wannabe Geek
 
Join Date: Jan 2007
Location: Dublin
Posts: 406
Nominated 0 Times in 0 Posts
TOTW/F/M Award(s): 0
ziycon will become famous soon enough
Send a message via MSN to ziycon Send a message via Skype™ to ziycon
Default

Quote:
Originally Posted by davidbehan View Post
Do you still need a hand with this? I've done it recently on a site.
Got it sorted, only thing i did come across is, if i use say www.mysite.com/myname and i have a forum setup www.mysite.com/forum/ then the forum wont work, i got around this by rewriting to www.mysite.com/blog/myname and the forum stays at www.mysite.com/forum!
Any ideas how to get around this?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #14 (permalink)  
Old 26-02-2008, 01:22 AM
Hardcore Geek
 
Join Date: Nov 2006
Location: Navan, Meath
Posts: 566
Nominated 0 Times in 0 Posts
TOTW/F/M Award(s): 0
davidbehan is a name known to alldavidbehan is a name known to alldavidbehan is a name known to alldavidbehan is a name known to alldavidbehan is a name known to alldavidbehan is a name known to all
Send a message via Skype™ to davidbehan
Default

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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #15 (permalink)  
Old 26-02-2008, 01:37 AM
Frodo's Avatar
Ciaran Rooney - Weeno Ltd
 
Join Date: Jan 2007
Location: London
Posts: 359
Nominated 0 Times in 0 Posts
TOTW/F/M Award(s): 0
Frodo has much to be proud ofFrodo has much to be proud ofFrodo has much to be proud ofFrodo has much to be proud ofFrodo has much to be proud ofFrodo has much to be proud ofFrodo has much to be proud ofFrodo has much to be proud ofFrodo has much to be proud of
Send a message via MSN to Frodo Send a message via Skype™ to Frodo
Default

3 ways to do it

1. daves way
2. add this to the top of you .htaccess
Code:
RewriteRule ^/?(forum)/$ forum/index.php [L]
3. add a .htaccess file to the forum folder with "RewriteEngine off"

Another helpful rule is

Code:
#
# ONLY FOR TESTING REWRITE RULES!!!!!
#
RewriteLog "/tmp/rewrite.log"
RewriteLogLevel 5
NEVER use this rule on a live site only use it for testing, the log files would be HUGE
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #16 (permalink)  
Old 26-02-2008, 01:46 AM
Hardcore Geek
 
Join Date: Nov 2006
Location: Navan, Meath
Posts: 566
Nominated 0 Times in 0 Posts
TOTW/F/M Award(s): 0
davidbehan is a name known to alldavidbehan is a name known to alldavidbehan is a name known to alldavidbehan is a name known to alldavidbehan is a name known to alldavidbehan is a name known to all
Send a message via Skype™ to davidbehan
Default

Quote:
Originally Posted by Frodo View Post
3 ways to do it

1. daves way
2. add this to the top of you .htaccess
Code:
RewriteRule ^/?(forum)/$ forum/index.php [L]
3. add a .htaccess file to the forum folder with "RewriteEngine off"

Another helpful rule is

Code:
#
# ONLY FOR TESTING REWRITE RULES!!!!!
#
RewriteLog "/tmp/rewrite.log"
RewriteLogLevel 5
NEVER use this rule on a live site only use it for testing, the log files would be HUGE
Not promoting my own here but 2 would redirect everything from mysite.com/forum/ to mysite.com/forum/index.php and ignore the rest of the rules. Although it would work, personally I'd prefer not to see index.php. With 3, you won't be able to use htaccess in that folder then and I presume that you will want that if it's set up like this forum for example (see url above). If I'm wrong with that analysis of that rewrite code, sorry - I've only been writing them for a couple of months now.

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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #17 (permalink)  
Old 26-02-2008, 01:56 AM
ziycon's Avatar
Wannabe Geek
 
Join Date: Jan 2007
Location: Dublin
Posts: 406
Nominated 0 Times in 0 Posts
TOTW/F/M Award(s): 0
ziycon will become famous soon enough
Send a message via MSN to ziycon Send a message via Skype™ to ziycon
Default

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?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #18 (permalink)  
Old 26-02-2008, 01:59 AM
Hardcore Geek
 
Join Date: Nov 2006
Location: Navan, Meath
Posts: 566
Nominated 0 Times in 0 Posts
TOTW/F/M Award(s): 0
davidbehan is a name known to alldavidbehan is a name known to alldavidbehan is a name known to alldavidbehan is a name known to alldavidbehan is a name known to alldavidbehan is a name known to all
Send a message via Skype™ to davidbehan
Default

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.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #19 (permalink)  
Old 26-02-2008, 02:10 AM
ziycon's Avatar
Wannabe Geek
 
Join Date: Jan 2007
Location: Dublin
Posts: 406
Nominated 0 Times in 0 Posts
TOTW/F/M Award(s): 0
ziycon will become famous soon enough
Send a message via MSN to ziycon Send a message via Skype™ to ziycon
Default

Quote:
Originally Posted by davidbehan View Post
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.
Ye, its on XP pro, i'll setup a redhat server tomorrow then and try get apache and all working on it! Never setup an *nix webserver box before! should be fun!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #20 (permalink)  
Old 26-02-2008, 05:36 AM
Frodo's Avatar
Ciaran Rooney - Weeno Ltd
 
Join Date: Jan 2007
Location: London
Posts: 359
Nominated 0 Times in 0 Posts
TOTW/F/M Award(s): 0
Frodo has much to be proud ofFrodo has much to be proud ofFrodo has much to be proud ofFrodo has much to be proud ofFrodo has much to be proud ofFrodo has much to be proud ofFrodo has much to be proud ofFrodo has much to be proud ofFrodo has much to be proud of
Send a message via MSN to Frodo Send a message via Skype™ to Frodo
Default

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.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Reply

Tags
modrewrtie, quesyion, quick

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump

Similar Threads

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


Sponsored links

Paid On Results


All times are GMT +1. The time now is 09:17 PM.


Powered by: vBulletin Version 3.7.3, Copyright ©2000 - 2008, Jelsoft Enterprises Limited.
Hosted in Ireland by Blacknight - Test your ISP |Irish Hosting Directory| Armchair.ie|Logo by Eden Web Design|Avatars by Afterglow |Latest Blog Entries | VPS HostingAd Management by RedTyger

Search Engine Friendly URLs by vBSEO 3.2.0