Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

Coding Forum


You are currently viewing our Coding Forum as a guest. Please register to participate.
Login



Reply
Redirecting, shorter urls, htaccess
Old 02-06-2004, 09:49 AM Redirecting, shorter urls, htaccess
Average Talker

Posts: 19
Location: UK
Trades: 0
Hi,

Hope someone can give us a hand!

I've done a good look round the web, but just got more confused, and didnt quite find what I need (I think!)

Basically, I want to make shorter urls.

I have URLS like this:
http://www.domain.com/cgi-bin/list.pl?id=1
http://www.domain.com/cgi-bin/list.pl?id=2
http://www.domain.com/cgi-bin/list.pl?id=3
..etc

What I want to try and do, is this:
http://www.domain.com/list/1
http://www.domain.com/list/2
http://www.domain.com/list/3
...etc and have them redirect to the correct full url

I'm sure this is something to do with the .htaccess file, and the rewrite option, but I can't quite find the correct syntax I need.
I can find similar, usually more complicated examples, but so far no luck!

Any ideas welcome
Cheers
Mikey
MikeyB987 is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 02-06-2004, 05:33 PM
Webmaster Talker

Posts: 589
Trades: 0
Does your server allow server redirecsts? If not you will need to get a redirect code at hotscripts or scriptsearch
thevirus is offline
Reply With Quote
View Public Profile
 
Old 02-06-2004, 05:43 PM
Average Talker

Posts: 19
Location: UK
Trades: 0
As far as I know, yes.

I just don't know the syntax to put in for the rewrite in the .htacess file.
MikeyB987 is offline
Reply With Quote
View Public Profile
 
Old 02-10-2004, 10:56 AM
Average Talker

Posts: 19
Location: UK
Trades: 0
Sorry to bump this up, can anyone point me in the right direction?
MikeyB987 is offline
Reply With Quote
View Public Profile
 
Old 02-11-2004, 12:26 AM
Christopher's Avatar
Iced Cap

Latest Blog Post:
Cross-domain AJAX with JSONP
Posts: 3,110
Location: Toronto, Ontario
Trades: 0
SitePoint has a nice article on mod_rewrite. I think you're looking for something like this;

Code:
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule /list/([0-9]+) /cgi-bin/list.pl?id=$1
</IfModule>
__________________

Please login or register to view this content. Registration is FREE
- Latest Articles:
Please login or register to view this content. Registration is FREE
,
Please login or register to view this content. Registration is FREE

--
Please login or register to view this content. Registration is FREE

Christopher is offline
Reply With Quote
View Public Profile
 
Old 02-11-2004, 05:11 AM
Average Talker

Posts: 19
Location: UK
Trades: 0
Hi Chroder,

Thanks for the tip, and the article, very useful.
I'll let you know how I get on

Many thanks
Mike
MikeyB987 is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Redirecting, shorter urls, htaccess
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 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.34210 seconds with 12 queries