Forum Moderators: phranque

Message Too Old, No Replies

Apache Rewrite Rule wildcard not catching"-"

Troubleshoot

         

Macyui

8:13 pm on May 22, 2008 (gmt 0)

10+ Year Member



For all other urls this code works fine:

RewriteEngine On

RewriteRule ^stories/([^/]+)/([^/]+)\.html$ article.php?article=$1&extra=$2 [L]
RewriteRule ^stories/([^/]+)/$ article.php?article=$1 [L]

but as soon as the url contains a "-" it does not. I have searched exhaustively across google for a reason and have not found one. Any help would be greatly appreciated. Thank you.

jdMorgan

9:51 pm on May 22, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Please be more specific -- a couple of examples of URLs that work and URLs that don't work would be most helpful -- Use example.com as your domain name, please.

At first glance, there's nothing in your rules that is sensitive to hyphens, so a better description of "does not work" may be in order as well. What does or does not happen that you do or don't expect to happen?

Jim

Macyui

4:50 pm on May 27, 2008 (gmt 0)

10+ Year Member



Thank you for your reply Jim. Now it would seem that nothing is being redirected at all. I know apache is running and redirection does work, as I used a simple test to demonstrate it was working.

What is confusing me is that it works on my sandbox, but is not working on the new hosting (bluehost) it is not.

www.example.com/stories/articlename/

should redirect to

www.example.com/article.php?article=articlename

Macyui

5:12 pm on May 27, 2008 (gmt 0)

10+ Year Member



I have actually solved my own problem. I had accidentally put an .htaccess file in the stories directory.

I apologize for wasting valuable time for such a careless error.