close ad
Help us test the new Databridge BETA with MySQLi support
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues


php header location causes redirect loop

Thread began 2/05/2016 3:07 pm by Sweens | Last modified 2/17/2016 2:04 pm by Ray Borduin | 811 views | 3 replies |


php header location causes redirect loop


Hope someone can help with this, as it is a general php question, not related to a problem with any WA product.

I've moved from parameter based pages to 'friendly urls', using the following excerpt from my htaccess file:

RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s/content\.php\?su=([^\s&]+)&PgID=(\d+)&pu=([^\s&]+) [NC]
RewriteRule ^ /%1/%2/%3? [R=301,L]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^/]+)/(\d+)/([^/]+)\.html$ /content.php?su=$1&PgID=$2&pu=$3 [L,QSA]

All the above works fine.

However, if a visitor goes to a page from a search engine, say, and the pg_url has been updated; I'd like to change the url shown in the address bar.
The correct page is still found, from the PgID number, but the pg_url in the search engine might be /page-name.html but the new name is actually /better-name.html

I've tried this (from in php using the following (and variants of it), but the page always fails because of a redirect loop;

if ($_SERVER['REQUEST_URI'] <> '/". $WADApages->getColumnVal("short_url"). "/". $WADApages->getColumnVal("PgID") ."/". $WADApages->getColumnVal("pg_url") .".html') {
header("HTTP/1.1 301 Moved Permanently");
header("Location: /". $WADApages->getColumnVal("short_url"). "/". $WADApages->getColumnVal("PgID") ."/". $WADApages->getColumnVal("pg_url") .".html");

Very grateful to any pointers - I have tried numerous variants with the same results.

Many thanks

Sign in to reply to this post


No suggestions anyone?

Sign in to reply to this post

Ray BorduinWebAssist

I don't see the problem... I can figure it out in a premier support ticket by debugging the code on the live page.

Sign in to reply to this post


Hi Ray



Sign in to reply to this post

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question





Ease of use


security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...