Need help with rewrite rule
Web Server forum
Back To The Forum Home!Search!Private Messaging System

Web Server Talk Web Server Talk > Web Servers reviews > Apache Server configuration support > Need help with rewrite rule




  Last Thread   Next Thread Next
  Show Printable Version Email this Page Subscribe to this Thread      Post New Thread    Post A Reply      

    Need help with rewrite rule  
Lupus


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
01-28-07 12:25 PM

Hello all !

I could use some help setting up a rewrite rule.
This is what I want to do :
the URL http://www.domain.com/2007-001 should lead to www.domain.com/
somepage.php?id=2007-001
This is what I have :

<IfModule mod_rewrite.c>
Options +FollowSymlinks
RewriteEngine on
RewriteRule ^([^/]+)/?$ /somepage.php?id=$1 [QSA] [nc]
</IfModule>

This works if I'm working with a subdir (ie. http://www.domain.com/
subdir/2007-001) where the rewriterule is set inside the subdir and
the .php-file is placed in the root.

I'd like to remove the subdir, but it doesn't work. Somehow I must add
a condition stating that somepage.php must not be redirected, but I
honestly don't know how to do this... Can anyone help me ?


Regards,
Mathew






[ Post a follow-up to this message ]



    Re: Need help with rewrite rule  
Davide Bianchi


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
01-28-07 12:25 PM

On 2007-01-28, Lupus <mathieu.maes@gmail.com> wrote:
> I'd like to remove the subdir, but it doesn't work. Somehow I must add
> a condition stating that somepage.php must not be redirected, but I
> honestly don't know how to do this... Can anyone help me ?

Something like

RewriteCond     %{REQUEST_URI}  !/somepage.php.*$

before your rule.

But if you run a simple google search on this very same newsgroup,
I bet you'll find a thousand of the same problems with solutions.

Davide

--
No, my friends. No, money will never make you happy, and happy will never
make you money. That might be a wisecrack, but I doubt it.
-- Julius Henry "Groucho" Marx (http://en.wikiquote.org/wiki/Groucho_Marx)





[ Post a follow-up to this message ]



    Sponsored Links  




 





   All times are GMT. The time now is 11:45 PM.      Post New Thread    Post A Reply      
  Last Thread   Next Thread Next


Most Popular forums 

Forum Jump:
Rate This Thread:

Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is OFF
vB code is ON
Smilies are ON
[IMG] code is OFF
 
Medical and Health forum | Computer Games Reviews | Graphics design forum

Back To The Top
Home | Usercp | Faq | Register