Jump to content

mod_rewrite - can't figure this out!


Recommended Posts

Hi,

I am new to php and have to do a project that consists of a joke page, a jokelist page and the front page or index page. My problem is this: I have used the text below in my .htaccess page and the only thing I get when I run the index.php file is the list of joke categories which is right but when i click on a category it produces an not found error.

I am so confused, please can someone help!

 

 

 

 

RewriteEngine On

RewriteRule^/jokespage$ index.php

Link to comment
https://forums.phpfreaks.com/topic/208233-mod_rewrite-cant-figure-this-out/
Share on other sites

The code you have pasted will make Apache look for any URLs that matches /jokespage. I do not believe that the forward slash is passed to a .htaccess file though so it will never match anything. On the flip side, you will likely need the forward slash on the rewritten address. Fixing that would give you...

 

RewriteEngine On
RewriteRule^jokespage$ /index.php

 

This would take any request for http://yourdomain.com/jokespage, and would display http://yourdomain.com/index.php to the user.

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.