I have a question, If I have a url like http://www.mysite.com/#123 Code (markup): how can I access the 123 via php? is there a mod rewrite way so that i can change the url to http://www.mysite.com/?p=123 Code (markup): Any help appreciated. Thanks
I tried this too once, but as far as i could get information you cannot access this with PHP. What are you trying to do? Maybe there is another solution
i also have the same question as i cannot call a variable from get that has a # starting such as domain.com?data=#function
It's not accessible directly through PHP. The anchor isn't passed by the browser to the server in any headers. You could do it by using JavaScript to pass the variable through to a PHP page via AJAX, and then update some sort of session and reload the page. This isn't ideal though, and I wouldn't recommend it unless absolutely neccessary.
$domain = $_SERVER['HTTP_HOST']; $path = $_SERVER['SCRIPT_NAME']; $url = "http://" . $domain . $path; $mystring1="#"; $s1=strpos($url,$mystring1); $p=substr($url,$s1+1); // may you need to correct here $p - your required 123
Unless your page is going to be a single page application, or you are anchoring data - I wouldn't advise you to do that. This is an anchor, use javascript and pass the variable via ajax to the php component you are using. I suggest using jQuery Bennadel.com has some good videos on jquery and this style navigation.
Get $_SERVER['SCRIPT_NAME'] and use reg_ex Make sure, your htaccess has allowed rewrite rule to specific file.