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.

PHP Forum


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



Freelance Jobs

Reply
Grab Variable and Rewrite URL
Old 07-21-2009, 10:18 PM Grab Variable and Rewrite URL
Skilled Talker

Posts: 54
Trades: 0
I need a 'script' that reads the "directory" variable and rewrites itself into the URL.

An example of this is easily seen at ...

http://www.urbandictionary.com/%23%2...I%20need%20%23
http://www.urbandictionary.com/This is what I need

http://www.urbandictionary.com/defin...hat+I+need+%23
KellyAX is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 07-22-2009, 01:45 AM Re: Grab Variable and Rewrite URL
Novice Talker

Posts: 7
Name: Suresh
Trades: 0
U can easily do this with htaccess in linux server.
You also need database access so that you can perform the same well
iteamweb is offline
Reply With Quote
View Public Profile Visit iteamweb's homepage!
 
Old 07-22-2009, 05:55 PM Re: Grab Variable and Rewrite URL
Skilled Talker

Posts: 54
Trades: 0
Can you please tell me how I could do this, because according to you it is easy.
KellyAX is offline
Reply With Quote
View Public Profile
 
Old 07-22-2009, 07:48 PM Re: Grab Variable and Rewrite URL
NullPointer's Avatar
Will Code for Food

Posts: 2,815
Name: Matt
Location: Irvine, CA
Trades: 0
Try looking up .htaccess and mod rewrite.
__________________

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
|
Please login or register to view this content. Registration is FREE
NullPointer is offline
Reply With Quote
View Public Profile Visit NullPointer's homepage!
 
Old 07-24-2009, 02:46 PM Re: Grab Variable and Rewrite URL
Super Talker

Posts: 144
Name: Nick Mallare
Location: Olathe, KS
Trades: 0
Quote:
Originally Posted by iteamweb View Post
U can easily do this with htaccess in linux server.
You also need database access so that you can perform the same well
Quote:
Originally Posted by KellyAX View Post
Can you please tell me how I could do this, because according to you it is easy.
Quote:
Originally Posted by NullPointer View Post
Try looking up .htaccess and mod rewrite.
I, too, thought this would be easy. Granted, I am no .htaccess expert, but I do have enough knowledge to be dangerous.

Anywho, I attempted to create a RewriteRule, and had little success. Perhaps it was because I did not escape my pound [#] sign?

Nick
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
nmallare is offline
Reply With Quote
View Public Profile Visit nmallare's homepage!
 
Old 07-24-2009, 04:48 PM Re: Grab Variable and Rewrite URL
Sergey Popov's Avatar
Junior Talker

Posts: 4
Name: Sergey Popov
Trades: 0
Quote:
Originally Posted by KellyAX View Post
I need a 'script' that reads the "directory" variable and rewrites itself into the URL...
If you can edit .htaccess, try to add these rows:

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^/]+)/?$ /define.php?term=$1 [R=301,L]

(2 conditions are to avoid conflicts with existing directories, like /images )

Should work for Apache, with mod rewrite.
__________________
freelance
Please login or register to view this content. Registration is FREE
for hire
Please login or register to view this content. Registration is FREE
Sergey Popov is offline
Reply With Quote
View Public Profile Visit Sergey Popov's homepage!
 
Old 07-24-2009, 11:51 PM Re: Grab Variable and Rewrite URL
Novice Talker

Posts: 4
Name: rajesh
Trades: 0
good information
__________________

Please login or register to view this content. Registration is FREE
junction4seo is offline
Reply With Quote
View Public Profile
 
Old 07-25-2009, 11:31 AM Re: Grab Variable and Rewrite URL
Novice Talker

Posts: 5
Trades: 0
tutorial on .htaccess (honestly a better option then to make a script) , make sure this is applicable to your webserver's software though.

http://www.freewebmasterhelp.com/tutorials/htaccess/
http://www.freewebmasterhelp.com/tutorials/htaccess/2
__________________

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
-
Please login or register to view this content. Registration is FREE
-
Please login or register to view this content. Registration is FREE
nizno is offline
Reply With Quote
View Public Profile
 
Old 07-25-2009, 06:03 PM Re: Grab Variable and Rewrite URL
Junior Talker

Posts: 4
Trades: 0
Use .htaccess, there is a ton of guides on the internet as to how to get round it. It'll give you tips as to how to use mod_rewrite. But the main part of it is trial and error... Although I will say this: The ORDER of your rules can be crucial as to whether your rewrite will work!
MarginalLiaison is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Grab Variable and Rewrite URL
 

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