| | |
url splitting
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
Thread Solved |
i forgot how to split urls 
i m trying to get 1,1,1,10.html n assign each value before commas to variables
any ideas??

php Syntax (Toggle Plain Text)
$url = "http://www.myhost.com/1,1,1,10.html";
i m trying to get 1,1,1,10.html n assign each value before commas to variables
any ideas??
Do a favour, leave me alone
<?php
$urloriginal = "http://www.mazur.com.ar/galeria/index.php?id=25";
echo "URL original: " . $urloriginal . "<br><br>\n";
$urloriginal = eregi_replace("http://", "", $urloriginal);
echo "URL original sin http//: " . $urloriginal . "<br><br>\n";
$parametros = stristr($urloriginal, "/");
echo "The request part: " . $parametros . "<br><br>\n";
$dominio = substr($urloriginal, 0, strpos($urloriginal, "/"));
echo "El dominio es: $dominio";
?>
ch.-
$urloriginal = "http://www.mazur.com.ar/galeria/index.php?id=25";
echo "URL original: " . $urloriginal . "<br><br>\n";
$urloriginal = eregi_replace("http://", "", $urloriginal);
echo "URL original sin http//: " . $urloriginal . "<br><br>\n";
$parametros = stristr($urloriginal, "/");
echo "The request part: " . $parametros . "<br><br>\n";
$dominio = substr($urloriginal, 0, strpos($urloriginal, "/"));
echo "El dominio es: $dominio";
?>
ch.-
yes i did.. but it s not the thing i want.
i will work on it
i will work on it
php Syntax (Toggle Plain Text)
<? // i add this part $_SERVER['FULL_URL'] = 'http'; if($_SERVER['HTTPS']=='on'){$_SERVER['FULL_URL'] .= 's';} $_SERVER['FULL_URL'] .= '://'; if($_SERVER['SERVER_PORT']!='80') $_SERVER['FULL_URL'] .= $_SERVER['HTTP_HOST'].':'.$_SERVER['SERVER_PORT'].$_SERVER['SCRIPT_NAME']; else $_SERVER['FULL_URL'] .= $_SERVER['HTTP_HOST'].$_SERVER['SCRIPT_NAME']; if($_SERVER['QUERY_STRING']>' '){$_SERVER['FULL_URL'] .= '?'.$_SERVER['QUERY_STRING'];} $url = $_SERVER['FULL_URL']; $urloriginal = $url; echo "URL original: " . $urloriginal . "<br><br>\n"; $urloriginal = eregi_replace("http://", "", $urloriginal); echo "URL original sin http//: " . $urloriginal . "<br><br>\n"; $parametros = stristr($urloriginal, "/"); echo "The request part: " . $parametros . "<br><br>\n"; $dominio = substr($urloriginal, 0, strpos($urloriginal, "/")); echo "El dominio es: $dominio"; ?>
Last edited by fatihpiristine; Nov 5th, 2007 at 10:31 am.
Do a favour, leave me alone
tested and works ok..
another thing.. this is my url
http://www.blabla.com/en/category/25698
assignment:
language = en
category = category
id = 25698
sql does the query but when i redirect to this location i got 404 error.
how can i solve this?s
another thing.. this is my url
http://www.blabla.com/en/category/25698
assignment:
language = en
category = category
id = 25698
sql does the query but when i redirect to this location i got 404 error.
how can i solve this?s
Last edited by fatihpiristine; Nov 5th, 2007 at 4:15 pm.
Do a favour, leave me alone
i figured out. with htaccess file 
RewriteEngine On
RewriteRule ^\.htaccess$ - [F] #to avoid accessing .htaccess files
RewriteRule ^\.jpg$ - [F] #jpg
RewriteRule ^\.html$ - [F] # htmls
RewriteRule ^\.css$ - [F] # css
RewriteRule ^([0-9]+),([0-9]+)$ /index.php?Language=$1&Index=$2 [L]

RewriteEngine On
RewriteRule ^\.htaccess$ - [F] #to avoid accessing .htaccess files
RewriteRule ^\.jpg$ - [F] #jpg
RewriteRule ^\.html$ - [F] # htmls
RewriteRule ^\.css$ - [F] # css
RewriteRule ^([0-9]+),([0-9]+)$ /index.php?Language=$1&Index=$2 [L]
Do a favour, leave me alone
![]() |
Similar Threads
- Save Time and Effort in Typing URL Addresses (Windows tips 'n' tweaks)
- a non-destructive repartitioning tool? (*nix Software)
- Splitting Files ., Making them fit to a CD (Windows NT / 2000 / XP)
- IE Cache not deleting a URL (Web Browsers)
- URL Changes!! (Web Browsers)
- IE URL Suffix (Web Browsers)
- url redirects to yahoo.com (Windows NT / 2000 / XP)
Other Threads in the PHP Forum
- Previous Thread: MySQL vs. SQL Server
- Next Thread: What's going on here?
| Thread Tools | Search this Thread |
Tag cloud for PHP
.htaccess access ajax apache api array beginner binary broken cakephp checkbox class cms code cron curl database date development directory display download dynamic echo email error file files filter folder form forms function functions gc_maxlifetime google host href htaccess html image include insert integration ip java javascript joomla limit link login loop mail memmory memory menu mlm mod_rewrite multiple mysql navigation oop parse parsing paypal pdf php problem query radio random recursion regex remote script search server sessions sms snippet soap source space sql structure syntax system table thesishelp tutorial update upload url validation validator variable video web xml youtube





