Redirecting a webpage

Dear Experts,

I need to redirect the url:


But each time I try, the browser says that it stops executing the page because of a loop.

How do I redirect this?
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.


RewriteRule   ^page1.php$    /page1.php?id=1     [L]

Can you not have a php statement where if id="" then:

  <meta http-equiv="Refresh" content="0; url=">

You can't, the loop is real : will be redirected to :)

What you try to acive seems to be that you will get an default parameter "id" for users calling the page without.

You could do this in code (when 'id' is null/empty -> 'id' = "1")
The 7 Worst Nightmares of a Sysadmin

Fear not! To defend your business’ IT systems we’re going to shine a light on the seven most sinister terrors that haunt sysadmins. That way you can be sure there’s nothing in your stack waiting to go bump in the night.

Or something like this:
  if (!isset($_GET['id'])) { header('location:'); }

Open in new window

if you want to avoid a redirect you can use

if (!isset($_GET['id'])) {$_GET['id']=1;}

Open in new window

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
check, if the qs is empty:
RewriteEngine on
RewriteCond %{QUERY_STRING} =""
RewriteRule   ^page1\.php$    /page1.php?id=1     [L]

Open in new window

It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Apache Web Server

From novice to tech pro — start learning today.