Forum Moderators: phranque

Message Too Old, No Replies

rewrite index.php effecting all files on site

Index.php rewriterule effects all files on site.

         

Odlaw

9:25 pm on Nov 15, 2005 (gmt 0)



I'm pretty new to mod_rewrite...and it's very cool but I find my self getting frustrated with simple things. I hope you can help straighten me out. This is what I am trying to do:

I have a site that I want the end user to type in http://example.com/123/ or http://example.com/234. This is what I have for a .htaccess:

RewriteEngine On
RewriteRule signups/(.*)/ index.php?story=$1
RewriteRule signups/(.*) index.php?story=$1

It kind of works, my problem is that it affects all my files, so I can not go to http://example.com/file2.php. My variable story is only going to be integers, so that should help things. I'll probably be adding more to the file so I am thinking I need the [L] flag.

I'm just totally lost and confused. Thanks for any help.

[edited by: jdMorgan at 1:35 am (utc) on Nov. 16, 2005]
[edit reason] example.com [/edit]

jdMorgan

12:42 am on Nov 16, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Odlaw,

Welcome to WebmasterWorld!

This should do for both cases - trailing slash or no trailing slash, and integers only:


RewriteEngine On
RewriteRule ^signups/([0-9]+)/?$ /index.php?story=$1 [L]

It's not clear from your example URLs... Where does "signups" enter in to it?

Jim