Need your attention for url rewritting functioning

Started on the old forum in July 2012 · view the original in the archive · old links redirect here

12 replies · 998 views · started 14 years ago · 1 min read

4 participants
mansi Developer · 60 posts #1

hi frnd,, I am trying to make my site look more simple by url rewriting ,, but as i am ok with making refernce from my virtual address to original address... like youthmp3.com/char-a.html will actually refer to youthmp3.com/?char=a correctly but it does not do what i want , if user open youthmp3.com/?char=a in there browser it acctually show the original address but i want to change this address to virtual address in user browser referring the original address if they choose original address...

any one pls provide appropriate knowledge or solution for this problem.. waiting for ur response...

and you may got my point correctly wisiting this site and see the address bar while searching... mp3skull.com - Free Mp3 Download

asifnayem Developer · 119 posts #2

mansi wrote: hi frnd,, I am trying to make my site look more simple by url rewriting ,, but as i am ok with making refernce from my virtual address to original address... like youthmp3.com/char-a.html will actually refer to youthmp3.com/?char=a correctly but it does not do what i want , if user open youthmp3.com/?char=a in there browser it acctually show the original address but i want to change this address to virtual address in user browser referring the original address if they choose original address...

any one pls provide appropriate knowledge or solution for this problem.. waiting for ur response...

and you may got my point correctly wisiting this site and see the address bar while searching... mp3skull.com - Free Mp3 Download

try these ideas: redirect with .htaccess

RewriteEngine On
redirect 301 /index.php?char=$1   http://youthmp3.com/char-(.*).html

or redirect with php (put this top of ur page.)

<?php header("Location: http://youthmp3.com/char-a.html", true, 301); ?>

Hope this will help.

mansi Developer · 60 posts #3

i try this but not working... 🙁

this warning comes when using 2nd option

Warning: Cannot modify header information - headers already sent

Ghost Senior · 366 posts #4

mansi wrote: i try this but not working... 🙁

this warning comes when using 2nd option

Warning: Cannot modify header information - headers already sent

change this

<?php header("Location: http://youthmp3.com/char-a.html", true, 301); ?>
//
//
//

to

<?php 
echo '<meta http-equiv="Refresh" content="0; url=http://youthmp3.com/char-a.html" />'; 
?>
//
//
//
//

it will remove the cannot modify header warning.

<?php include ('Ghost'); if ($Post == true) { echo ' ![](http://destrukt.dk/ico/phpdeveloper.jpg) alt='coding-talk.com!!' />'; echo 'Sharing Is Caring!'; } else { echo ' ![](http://img98.imageshack.us/img98/6476/av3ro4.jpg) alt='the username GHOST has been comprimised!' />'; echo 'OMG SOMEBODY HELP ME!!'; } ?>
mansi Developer · 60 posts #5

Is this possible if we want to redirect to same page... like inhex.php to index.html and refer to index.php actually..

Ghost wrote: change this

<?php header("Location: http://youthmp3.com/char-a.html", true, 301); ?>
//
//
//

to

<?php 
echo '<meta http-equiv="Refresh" content="0; url=http://youthmp3.com/char-a.html" />'; 
?>
//
//
//
//

it will remove the cannot modify header warning.

khan Lead · 681 posts #6

Hello, This redirect function could come handy to u, if you prefer php redirection.

function redirect($url){
    if (!headers_sent()){    //If headers not sent yet... then do php redirect
        header('Location: '.$url); exit;
    }else{                    //If headers are sent... do java redirect... if java disabled, do html redirect.
        echo '<script type="text/javascript">';
        echo 'window.location.href="'.$url.'";';
        echo '</script>';
        echo '<noscript>';
        echo '<meta http-equiv="refresh" content="0;url='.$url.'" />';
        echo '</noscript>'; exit;
    }
}

Uses:

	$redir = "http://yoursite.tld/yourpage.ext";
	echo redirect($redir);

As far as I can understand that you are concerning about your page to redirect to the new rules that you created in your .htaccess. you should go for the htaccess codes that ASIFNAYEM gave above. without 301 redirection method, you may face seo problem for duplicate content.

👍 1
Share
mansi Developer · 60 posts #7

thank u so mr khan this post really help... just one more question i know its may be very silly question.. i want to change user value properly like if user enter " helo hw r + u " to something like "helo hw r u" i want to remove all white space character from this and replace multiple space with one space bt there must be no space at the start and end of the string..

khan wrote: Hello, This redirect function could come handy to u, if you prefer php redirection.

function redirect($url){
    if (!headers_sent()){    //If headers not sent yet... then do php redirect
        header('Location: '.$url); exit;
    }else{                    //If headers are sent... do java redirect... if java disabled, do html redirect.
        echo '<script type="text/javascript">';
        echo 'window.location.href="'.$url.'";';
        echo '</script>';
        echo '<noscript>';
        echo '<meta http-equiv="refresh" content="0;url='.$url.'" />';
        echo '</noscript>'; exit;
    }
}

Uses:

	$redir = "http://yoursite.tld/yourpage.ext";
	echo redirect($redir);

As far as I can understand that you are concerning about your page to redirect to the new rules that you created in your .htaccess. you should go for the htaccess codes that ASIFNAYEM gave above. without 301 redirection method, you may face seo problem for duplicate content.

mansi Developer · 60 posts #8

here i use this solution in my script thanks for your support members... I know there must be a better solution to do this.. like submitting value by form after modifying... if there is any better solution pls tell me... here the link : Ek tha tiger Free Mp3 Download

once again thanks for your presence.. 🙂

asifnayem Developer · 119 posts #9

you could certainly get help from khan bro. he got a site named hitnhot.com. I can see that he use the songspk and musicbd grabber. and he may help you to do things like him.

mansi Developer · 60 posts #10

asifnayem wrote: you could certainly get help from khan bro. he got a site named hitnhot.com. I can see that he use the songspk and musicbd grabber. and he may help you to do things like him.

thanks, but i already have much better and functioning script sir.. my songs album shows pic and download songs also modified according to them... now i am thinking about to change my mob and pc version of youthmp3 to same address like this coding-talk forum. if you have any knowledge about storing user ip address with a single value only for 1 day pls share,, its helpful for me..

khan Lead · 681 posts #11

asifnayem wrote: you could certainly get help from khan bro. he got a site named hitnhot.com. I can see that he use the songspk and musicbd grabber. and he may help you to do things like him.

Its not a grabber anymore. All the data are in mysql db to get the best use of grabber. no one can ever imagine the songs are taken from other site. Now Its just a simple database connected site. nothing else dude.

Hey Mansi, I've visited your site. I think you've done a fantabulous job except the ads. you shouldn't choose popup ads. also you should be more choosy in css design too. your site has contents. if you can redesign or be more slick in your design of the site you can get popularity in no time.

mansi Developer · 60 posts #12

khan wrote: Its not a grabber anymore. All the data are in mysql db to get the best use of grabber. no one can ever imagine the songs are taken from other site. Now Its just a simple database connected site. nothing else dude.

Hey Mansi, I've visited your site. I think you've done a fantabulous job except the ads. you shouldn't choose popup ads. also you should be more choosy in css design too. your site has contents. if you can redesign or be more slick in your design of the site you can get popularity in no time.

thanks mr khan ,, bt i not add any pop ad in my site... actually its my first time in pc site so i just dnt know what to do with it... ***** is my gmail id ,, may i learn from you if you dnt mind

asifnayem Developer · 119 posts #13

khan wrote: Its not a grabber anymore. All the data are in mysql db to get the best use of grabber. no one can ever imagine the songs are taken from other site. Now Its just a simple database connected site. nothing else dude.

Oh apology. my mistake. though I'm ur regular visitor for online music player.

Write your reply now; next you create a free account (or sign in) and it is posted right away. 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