Simplest URL fails, is HTACCESS wrong?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
simonmlewis
DevNet Master
Posts: 4435
Joined: Wed Oct 08, 2008 3:39 pm
Location: United Kingdom
Contact:

Simplest URL fails, is HTACCESS wrong?

Post by simonmlewis »

On the contact page, I am trying to take the user to /contact-us&c=y

But if I do, my script that checks if a page exists, says it doesnt, but this is part of contact-us.

Code: Select all

DirectoryIndex index.php index.html index.htm
order allow,deny
allow from all 

RewriteEngine On
Options +FollowSymLinks
Options +Indexes

RewriteRule ^(blog)($|/) - [L]
RewriteRule ^categ/([0-9]+)/([^/]+) /index.php?page=categ&c=$1&cname=$2 [QSA]
RewriteRule ^categ/([0-9]+) /index.php?page=categ&c=$1 [QSA]
RewriteRule ^categ/page/([0-9]+)/([^/]+)/([0-9]+) /index.php?page=categ&c=$1&cname=$2&pagenum=$3 [L]

RewriteRule ^product/([0-9]+)/([^/]+)/([^/]+)/([^/]+) /index.php?page=product&c=$1&category=$2&id=$3&h=$4 [QSA]

RewriteRule ^productsall/([0-9]+)/ /index.php?page=productsall&pagenum=$1/ [L]

RewriteRule ^([^/\.]+)/?$ index.php?page=$1 [QSA]

RewriteRule ^$ index.php?page=home [QSA]

Code: Select all

$page= isset($_GET['page']) ? $_GET['page'] : null;
  function getPage(PDO $pdo)
  {
  $thispage="includes/".$_GET['page'].".inc";

  if (file_exists($thispage)) 
  {
   include $thispage;
  } 
  else 
  {
  echo "<meta http-equiv='Refresh' content='0 ;URL=/'>";
  }
  }  
Love PHP. Love CSS. Love learning new tricks too.
All the best from the United Kingdom.
User avatar
Celauran
Moderator
Posts: 6427
Joined: Tue Nov 09, 2010 2:39 pm
Location: Montreal, Canada

Re: Simplest URL fails, is HTACCESS wrong?

Post by Celauran »

simonmlewis wrote:On the contact page, I am trying to take the user to /contact-us&c=y
Shouldn't that be /contact-us?c=y ?
simonmlewis
DevNet Master
Posts: 4435
Joined: Wed Oct 08, 2008 3:39 pm
Location: United Kingdom
Contact:

Re: Simplest URL fails, is HTACCESS wrong?

Post by simonmlewis »

Tried that:
<meta http-equiv='Refresh' content='0 ;URL=/contact-us?c=y'>
It's that URL it doesn't like, as if I remove that, it processes it to the contact-us page. But won't go any further.
Love PHP. Love CSS. Love learning new tricks too.
All the best from the United Kingdom.
Post Reply