Jump to content

.htaccess not working (previously it was working)


ali_kiyani

Recommended Posts

Hi,

 

I have the following file structure

 

/.htaccess
/index.php
/displaypage.php

 

All files are on root.

 

I have following written in .htaccess file

 

Options FollowSymLinks
RewriteEngine On

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule ^([a-z0-9-]+)$ displaypage.php?page=$1 [NC,L]

 

I have following written in displaypage.php

 

echo $_GET["page"];

 

Now when I run http://localhost/ then it shows index.php page which is correct. If I run http://localhost/something then it shows a blank page. Previously it used to display that "page" variable on screen. mod_rewrite is enabled and I am using Windows with XAMPP.

 

What am I doing wrong?

 

Thanks

Blank php pages are usually the result of a fatal php parse error on the page.

 

Have you tested displaypage.php by browsing directly to it and do you have error_reporting set to E_ALL and display_errors set to ON in your master php.ini so that all php detected errors will be reported and displayed?

Have you tested displaypage.php by browsing directly to it

This did the trick. I browsed it directly and it was same blank page. Went to code and saw that I am missing "php" between these  <?php echo....?>

Problem solved. Many thanks!

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.