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
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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.