Jump to content

.htaccess calling php file with require index.php


nghi
 Share

Recommended Posts

I'm getting this error below. I'm not sure what I'm doing wrong? (not sure if its overkill to include pw to the htaccess)

Error

Error: Call to undefined function wire() (line 5 of C:\wamp2\www\nghitest\parse.php)

.htaccess 

RewriteRule ^([\w\d]{6})$ parse.php?parse=$1 [L]

parse.php

<?php  
  
require("./index.php");
  
$short_url = wire('sanitizer')->url($_GET["parse"]);  

$url = wire('database')->query("SELECT url FROM shorturl WHERE short_url='{$short_url}'")->fetch();
  
if ($url)
header("location:" . $url);

?>  
Link to comment
Share on other sites

Hi,

which version of ProcessWire are you using ?

If you are under version 3.x.x, put this line at the begining of the file :

<?php namespace ProcessWire;

I'm currently using the 3.0.8 dev ver. I'll add the namespace when I get home and see how that goes.

*Update - Adding the namespace solve my problem thanks for the help.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...