Rewrited url (HELP PLEASE)

Started on the old forum in December 2010 · view the original in the archive · old links redirect here

18 replies · 1,056 views · started 15 years ago · 1 min read

15 participants
DiL Developer · 142 posts #1

HELLO friends,

i need a lil help about rewrite url.... as we knw that we can rewrite our by using URL ReWrite in .htaccess but my question is, how to get values from rewrited URL....

If your url is

http://www.coding-talk.com/index.php?uid=1212

and we rewrite it as

http://www.coding-talk.com/1212.html

now i wanna take 1212 from that url... can anyone help me about that...????

morency Senior · 488 posts #2

same like you get in normal way ...

Unamos los corazones,hoy todos somos multicolores!

frostymarvelous Senior · 266 posts #3

You need to use mod rewrite rules in ur htaccess

Perfection comes at a cost

I accept liberty!

GumSlone Administrator Principal · 1,690 posts #4

here is an example of my htaccess rewrite rules from xchanger.mobi

Options +FollowSymLinks
RewriteEngine On
RewriteRule ^up([0-9]+)/?$ /index.php?fileinfoid=$1 [QSA,L]
RewriteRule ^user([0-9]+)/?$ /index.php?profile=$1 [QSA,L]
RewriteRule ^u-(.*)/?$ /index.php?uname=$1 [QSA,L]
RewriteRule ^sess([0-9]+)/fil([0-9]+)/(.*)/?$ /index.php?PHPSESSID=$1&act=fileinfo&fid=$2 [QSA,L]
RewriteRule ^sess([0-9]+)/afil([0-9]+)/(.*)/?$ /index.php?PHPSESSID=$1&act=warning&fid=$2 [QSA,L]
RewriteRule ^zipget([0-9]+)/(.*)/(.*)\.zip /download.php?id=$1&tcheck=$2&mod=zip [L]
RewriteRule ^3gpget([0-9]+)/(.*)/(.*)\.3gp /download.php?id=$1&tcheck=$2&mod=3gp [L]
RewriteRule ^zc([0-9]+)-n([0-9]+)/(.*)/(.*)\.(.*) /download.php?id=$1&num=$2&tcheck=$3&mod=zipcontent [L]
RewriteRule ^get([0-9]+)/(.*)/(.*)\.(gif|jpg|jpeg|png|sis|sisx|jar|thm|png|nth|mid|midi|mmf|3gp|avi|mp4|aac|m4a|wav|mp3|amr|mpn|mpc|wbmp|bmp|zip) /download.php?id=$1&tcheck=$2 [L]

Advertise your mobile site for FREE with AdTwirl

External image (may be gone)

frostymarvelous Senior · 266 posts #6

Are there any free good ones for php?

Perfection comes at a cost

I accept liberty!

morse Senior · 364 posts #8

Hi, what is the benefit of MVC framework above .htaccess ??

tinyurl.com/earnbymobile Easy earning for Indians

Alternative mobile advertising network .. Minimum 100 USD pay / NET15 pay cycle, Good Brand, Best targeting for Android goo.gl/6vub3

opticalpigion Lead · 593 posts #9

DiL wrote: HELLO friends,

i need a lil help about rewrite url.... as we knw that we can rewrite our by using URL ReWrite in .htaccess but my question is, how to get values from rewrited URL....

If your url is

and we rewrite it as

now i wanna take 1212 from that url... can anyone help me about that...????

Options +FollowSymLinks
RewriteEngine on
RewriteRule (.*)\.html$ index.php?uid=$1
ramciv14 Junior · 26 posts #10

how to get the value?

$_GET['uid']

but i prefer to use a framework

frostymarvelous Senior · 266 posts #11

Yep. The underlying principle of the URL is the same, its just the appearance which has changed. So your script can remain the same. But you should rewrite all your urls to reflect the rule.

Perfection comes at a cost

I accept liberty!

ewanz Developer · 187 posts #12

It take many w0rks 0n my scripts t0 rewrite all url.. S0 damn

our lfe is simple words.... 😌 http://mygenkz.net ewanz06@yahoo.com

$output="i am NOoob....";
$newfile="ewanz.txt";
$file = fopen ($newfile, "w");
fwrite($file, $output);
fclose ($file); 
frostymarvelous Senior · 266 posts #13

Well you need to work hard to enjoy

Perfection comes at a cost

I accept liberty!

ewanz Developer · 187 posts #15

lazy is my attitude.. huhuhu... what difference use mod rewrited and framework?

our lfe is simple words.... 😌 http://mygenkz.net ewanz06@yahoo.com

$output="i am NOoob....";
$newfile="ewanz.txt";
$file = fopen ($newfile, "w");
fwrite($file, $output);
fclose ($file); 
abipol Junior · 11 posts #17

try this?

RewriteEngine on

RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule .+ - [L]
RewriteRule ^([A-Za-z0-9_-]+)$ profile.php?ID=$1 [QSA,L]

simple things can be a great sample!

warfrek Junior · 44 posts #18

huh?please poeple?do not just post codes here without explanati0ns. You might confuse others.

arnage Lead · 811 posts #19

ewanz wrote: It take many w0rks 0n my scripts t0 rewrite all url.. S0 damn

Use Notepad++ option in Seacrh > Replace...

<!DOCTYPE html PUBLIC "-//***WAPFORUM**.**RS***

Sign in to reply.

Similar topics

Keyboard shortcuts

g f
Go to forums
g h
Go to your feed
g m
Go to messages
r
Reply (in a topic)
/
Search
j
Next post
k
Previous post
?
This list
Ctrl/⌘ + Enter
Send what you are writing
Ctrl/⌘ + B / I
Bold / italic while writing
Esc
Close