Reply
Mod rewrite help
Old 03-24-2005, 09:35 AM Mod rewrite help
Python's Avatar
Ultra Talker

Latest Blog Post:
A new site is launched
Posts: 370
http://www.freewebmasterresources.net

I want to mod rewrite the URL's at that site so that they are more search engine friendly.


The current URL layout is:
http://www.freewebmasterresources.ne... IF Statements


Id like to convert the above to the following:
http://www.freewebmasterresources.ne...-IF-Statements

Anyone able to help?

Thanks
__________________
UK Web Site Design
- Affordable web site design solutions
Python is offline
Reply With Quote
View Public Profile Visit Python's homepage!
 
When You Register, These Ads Go Away!
Old 03-25-2005, 11:59 AM
simptech's Avatar
Skilled Talker

Posts: 81
Location: Cape Coral, Florida, United States
try this in a htaccess file in your main folder...

Code:
RewriteEngine On
RewriteRule ^(.*)/(.*)$	/index.php?cat=$1&t=$2 [L]
however, i would suggest structuring the urls like "/unused/language/blah-blah-blah"

that way, you can make sure that it is only handed to the script like so...

Code:
RewriteEngine On
RewriteRule ^(articles|walkthroughs|etc)/(.*)/(.*)$	/index.php?cat=$2&t=$3 [L]
basically keeping the hand-off limited to certain urls and not ALL of them.
__________________
PHPScripts4Free.com
FREE PHP scripts for your website!

Last edited by simptech : 03-25-2005 at 12:04 PM.
simptech is offline
Reply With Quote
View Public Profile Visit simptech's homepage!
 
Old 03-30-2005, 10:14 AM
Python's Avatar
Ultra Talker

Latest Blog Post:
A new site is launched
Posts: 370
Ok it works.... but there is a problem...

If the topic hasnt been selected(otherwords there is no $t variable and just a category) then the content doesnt show..

e.g.:

This works: http://www.freewebmasterresources.ne...F%20Statements

This doesnt: http://www.freewebmasterresources.net/webmaster/ASP/

The second one isnt showing up the listings as it normally does when it is accessed by http://www.freewebmasterresources.net/index.php?cat=ASP

Should I just recode the script itself so that it extracts the category from the url and then uses that to get the right content from the db instead of using a variable to extract it... or is there another way?
__________________
UK Web Site Design
- Affordable web site design solutions
Python is offline
Reply With Quote
View Public Profile Visit Python's homepage!
 
Old 03-30-2005, 10:38 AM
Python's Avatar
Ultra Talker

Latest Blog Post:
A new site is launched
Posts: 370
ok... no worries... Ive sorted it now.. thanks
__________________
UK Web Site Design
- Affordable web site design solutions
Python is offline
Reply With Quote
View Public Profile Visit Python's homepage!
 
Reply     « Reply to Mod rewrite help
 

Thread Tools

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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML

 


Page generated in 0.16530 seconds with 12 queries