Jump to content


mod_rewrite


4 replies to this topic

#1 Pooch

    Young Padawan

  • Members
  • Pip
  • 63 posts

Posted 19 March 2006 - 12:24 AM

Hey,

I tried implementing the mod_rewrite system on my server and it was worked fine until I switched some things around. I was wondering if the code below should work?

Options +FollowSymLinks
RewriteEngine on
RewriteRule ^login/$ index.php?page=login

When I try it I get a 404 error, file not found. Thanks for any help.

Edit: By the way www.mysite.com/index.php?page=login works fine.

Edited by Pooch, 19 March 2006 - 12:27 AM.


#2 Ruben K

    Cliff

  • Twodded Staff
  • PipPip
  • 438 posts

Posted 19 March 2006 - 07:01 AM

Are you using mod_rewrite on a subdomain?

#3 Pooch

    Young Padawan

  • Members
  • Pip
  • 63 posts

Posted 19 March 2006 - 09:57 AM

nope. Apparently I needed to use /index.php. Here's what I have so far. It doesn't seem to work though (500/302 error). What I'm trying to have it do is if mysite.com/page is called upon, it will then redirect it to mysite.com/page/ and then that will get passed through mysite.com/index.php?page=page.
In short I want the / to be optional.

Options +FollowSymLinks
RewriteEngine on
RewriteRule ^(.*)$ $1/ [R]
RewriteRule ^(.*)/$ /index.php?page=$1

Note: The second rule works fine alone.
Good Site for help: http://www.yourhtmlsource.com/sitemanageme...lrewriting.html

Edited by Pooch, 19 March 2006 - 10:32 AM.


#4 rc69

    PHP Master PD

  • P2L Staff
  • PipPipPipPip
  • 3,827 posts
  • Gender:Male
  • Location:Here
  • Interests:Web Development

Posted 19 March 2006 - 12:46 PM

Options +FollowSymLinks
RewriteEngine on
RewriteRule ^(.*)[/]?$ /index.php?page=$1
Put the forward slash in a character class, and use the ? delimiter to make it optional.

#5 Pooch

    Young Padawan

  • Members
  • Pip
  • 63 posts

Posted 19 March 2006 - 02:23 PM

View Postrc69, on Mar 19 2006, 12:46 PM, said:

Options +FollowSymLinks
RewriteEngine on
RewriteRule ^(.*)[/]?$ /index.php?page=$1
Put the forward slash in a character class, and use the ? delimiter to make it optional.

When I tried that I got error 500: Internal Server Error





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users