redirection

How can I quickly set up a RESTful site using PHP without a Framework?

I would like to quickly set up a RESTful site using PHP without learning a PHP Framework. I would like to use a single .htaccess-file in Apache or a single rule using Nginx, so I easyli can change web server without changing my code. So I want to direct all requests to a single PHP-file, and that file takes care of the RESTful-handling ...

How do I redirect a page in php

I'm having difficulties in the making the logout code for php to work. When I click on the logout button, it will go back to the home page, but when I click on the back button in the browser. I can still access the previous page, wherein the user must be logged on to access it. So I'm thinking of redirecting to the login page when the u...

mod_rewrite infinite loop problem

Hi guys, I've been trying to do the following with mod_rewrite on the server there is a file about.htm (which is found in the root directory of the domain) I need to redirect about.htm to about/ On the server still keep about.htm, hence when about/ is called, it actually loads up about.htm I tried something like this: RewriteRule ^...

How do I stop redirection after form submittion?

I had a similar question posted here a few hours ago, just now I got the answer that I should look into using AJAX to do this. Since I want to complete this part of the site today I can't afford to learn AJAX from the basics to do this now.. This shouldn't be something difficult and I thougt that I would be able to do this but I'm not sk...

output redirection in UNIX

I am a beginner in UNIX. I am finding some difficulty in input/output redirection. ls -l >temp cat temp Here why temp file is shown in the list and moreover, it is showing 0 characters. wc temp >temp cat temp here output is 0 0 0 temp. Why lines, words, characters are 0. Please help me to undestand this concept. ...

Url redirection in PHP

hi, i am having a url like http://localhost/joomla/Joomla_1.5.7/index.php?option=com_content&view=section&layout=blog&id=3&Itemid=55 and i want to redirect this to http://localhost/joomla/Joomla1.5/index.php?option=com_content&view=section&layout=blog&id=3&Itemid=55 Not only this redirection but whenev...

How can I use mod_rewrite to redirect children pages/directories to a parent directory?

So I have a whole series of redirects in place for a bunch of pages I want redirected to their parent directory (e.g. /faq/question1/ -> /faq/), but it's very inflexible, as they're manually generated. How can I set up a RegEx-fueled RewriteRule for this? I haven't been able to figure it out, and would dearly love some guidance. Here's ...

How to make a live stream redirector?

So I have a local URL like http://localhost:port/ with live video stream in it. I need to send it over TCP to http://any_address:AnyPort/ how to do such thing in WPF, C#? CODE WANTED!) ...

.htaccess redirect 404 error to directory if it exists

Is there any way to make /name.html and /name/ work interoperably in the event of a 404 error? For example, if the following fails: http://domain.com/name.html Then it would attempt: http://domain.com/name/ And only go to a 404 page if that directory didn't exist? The reverse would be interesting too, going from dir to .html, and then...

help regarding dynamic redirect rule in htaccess

hi all, I need ur help for given subject. I am playing with htaccess rules first time in life. here is the scene - i want to redirect the urls - http://www.abc.com/var1 http://www.abc.com/var2 to follwing urls - http://www.abc.com/index.php?u=var1 http://www.abc.com/index.php?u=var2 In this case the values var1 & var2 can...

Curious redirection problem using location.href

I face a curious problem with redirection... Look at this small example: it works only if I add the alert() call after the redirection sentence! If I remove the alert() it does not work anymore!!! Any idea why (I'm using Firefox 3)? Thanks. <html> <script type="text/javascript"> function GotoPage() { location.href = "htt...

can't read from stream until child exits?

OK I have a program that creates two pipes -> forks -> the child's stdin and stdout are redirected to one end of each pipe -> the parent is connected to the other ends of the pipes and tries to read the stream associated with the child's output and print it to the screen (and I will also make it write to the input of the child eventually...

Drupal - multilingual site - change language - redirect to same page in selected langauge

In a Drupal multilingual site, for custom modules, (not nodes) what is approach to assure that user navigates to same page in new language? example: en/mypage to de/mypage edit: menu hook looks like this: // add menu item $items['my_module_name'] = array( 'title' => t('My Page Title'), 'menu_name' =>...

php script redirecting code problem

hi, i'm using a php script for redirection after detecting the search word to my websiter from the search engines . and my redirection code is working fine but for some keywods i wat to stay in the same page. for that lines of code i'm getting a warning message in that pages. Warning: headers already sent (output started...

Regex pattern help (I almost have it, just need a bit of expertise to finish it)

I need to match two cases js/example_directory/example_name.js and js/example_directory/example_name.js?12345 (where 12345 is a digit string of unknown length and the directory can be limitless in depth or not exist at all) I need to capture in both cases everything between js/ and .js and if ? exists capture the digit stri...

after dup2, stream still contains old contents?

so if I do: dup2(0, backup); // backup stdin dup2(somefile, 0); // somefile has four lines of content fgets(...stdin); // consume one line fgets(....stdin); // consume two lines dup2(backup, 0); // switch stdin back to keyboard I am finding at this point.. stdin still contains the two lines I haven't consumed. Why is that? Because the...

Using .htaccess redirect a site root to a site subfolder

Hi, I want to be able to redirect my visitors from http://www.example.com and http://example.com to http://example.com/blog. How can I do that, I saw some examples but any of them works for me. Thanks. ...

Rails - how can I capture the URL that directed to the current action in my app?

Hi - I need to see what page a request came from in my controller so I could be able to redirect back to it. For example, if I'm on a page showing a specific product (say /products/1) and it has a link to its vendor (/vendors/12), I want to be able to detect inside the vendors_controller that I came to that page from /products/1. Is th...

[php] Firefox refreshes page 1, even after redirection to page 2

Hi! This is a quite weird and annoying problem, which is reproduced with the script below. Say we have two pages: script.php and script.php?second. Page 1 creates some database entries and redirects to page 2. On page 2, the user is presented with an editor for said entries. If page 1 for some reason crashes on the first try, and pri...

PHP Redirection with Post Parameters

Hello, I have a webpage. This webpage redirects the user to another webpage, more or less the following way: <form method="post" action="anotherpage.php" id="myform"> <?php foreach($_GET as $key => $value){ echo "<input type='hidden' name='{$key}' value='{$value}' />"; } ?> </form> <script> document.getElementById('m...