New Htaccess Issue

liunx

Guest
Hey Mike. Here's an interesting problem for you to decipher.<br /><br />I have the following rewrite rule:<br /><br /><!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->RewriteRule ^/*gamesdirectory/+(.*)\.html$ http://www.omgn.com/gamesdirectory.php?Item_ID=$1 [NE]<!--c2--></div><!--ec2--><br /><br />It doesn't work. Putting in "http://www.omgn.com/gamesdirectory/17.html" gets you to "http://www.omgn.com/gamesdirectory.php17.html?Item_ID=17"<br /><br />However, I have tried replacing the rewrite rule with:<br /><br /><!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->RewriteRule ^/*gamesdirector/+(.*)\.html$ http://www.omgn.com/gamesdirectory.php?Item_ID=$1 [NE]<!--c2--></div><!--ec2--><br /><br />Using the address without the ending 'y' works. I have modified that thing all over the place and they all work: but using the full "gamesdirectory" doesn't.<br /><br />Ideas?<!--content-->
I don't really see any issue with the first rewrite rule.<br /><br />I took your rewrite rule and tried it and it works just fine for me. I created a .php file just to output some info on the call:<br /><br /><!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->.htaccess:<br /><br />RewriteEngine On<br />RewriteRule ^/*gamesdirectory/+(.*)\.html$ http://www.testmonkey.ws/gamesdirectory.php?Item_ID=$1 [NE]<br /><br />Requested URL: /gamesdirectory/17.html<br />File actually served: /gamesdirectory.php<br />Arguments Passed: Item_ID=17<!--c2--></div><!--ec2--><br /><br />For the moment I have it still available if you want to try it yourself.<br /><br /><!--coloro:blue--><span style="color:blue"><!--/coloro-->http://testmonkey.ws/gamesdirectory/25.html<!--colorc--></span><!--/colorc--><br /><br />Change the 25 to whatever.<br /><br />For reference, this is my gamesdirectory.php contents:<br /><!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1--><html><br /><body><br />.htaccess:<br /><hr><br /><pre><br /><?php include('.htaccess'); ?><br /></pre><br /><hr><br /><p><br /><?php<br />    print("Requested URL: ".$REQUEST_URI."<br>File actually served: ".$PHP_SELF."<br>Arguments Passed: ".$QUERY_STRING);<br />?><br /></body><br /></html><!--c2--></div><!--ec2--><!--content-->
Hm...<br /><br />Welp, not sure on this one. I'll have to research it further, 'cause it surely ain't workin'.<!--content-->
Two questions....<br /><br />1. Does it work for you when you hit my URL?<br />2. Do you have other rules in your .htaccess file?<!--content-->
1) Yes, yours works.<br />2) I have other rules in my HTACCESS... Including the image protection we ironed out awhile back, I have the following ones right before the gamesdirectory rule, same format:<br /><br /><!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->RewriteRule ^/*news/+(.*)\.html$ http://www.omgn.com/news.php?Item_ID=$1 [NE]<br />RewriteRule ^/*reviews/+(.*)\.html$ http://www.omgn.com/reviews.php?Item_ID=$1 [NE]<br />RewriteRule ^/*editorials/+(.*)\.html$ http://www.omgn.com/editorials.php?Item_ID=$1 [NE]<br />RewriteRule ^/*interviews/+(.*)\.html$ http://www.omgn.com/interviews.php?Item_ID=$1 [NE]<!--c2--></div><!--ec2--><br /><br />I'm slowly getting things added to be more search-engine friendly (And making them seem like permanent URLs for my Print/Save/Newsfeeds functions)...<!--content-->
I'd recommend, just to test it, removing the other rules to see if somehow you have another rule that's also getting applied. That'll help narrow it down.<!--content-->
A new interesting development:<br /><br /><!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->RewriteRule ^/*(announcements|news|reviews|editorials|interviews|gamesdirectory)/+(.*)\.html$ http://www.omgn.com/$1.php?Item_ID=$2 [NE]<!--c2--></div><!--ec2--><br /><br />That works for all of the following:<br /><br /><a href="http://www.omgn.com/announcements/9.html" target="_blank">http://www.omgn.com/announcements/9.html</a><br /><a href="http://www.omgn.com/news/9.html" target="_blank">http://www.omgn.com/news/9.html</a><br /><a href="http://www.omgn.com/reviews/9.html" target="_blank">http://www.omgn.com/reviews/9.html</a><br /><a href="http://www.omgn.com/interviews/8.html" target="_blank">http://www.omgn.com/interviews/8.html</a><br /><a href="http://www.omgn.com/editorials/9.html" target="_blank">http://www.omgn.com/editorials/9.html</a><br /><br />And not the following:<br /><br /><a href="http://www.omgn.com/gamesdirectory/9.html" target="_blank">http://www.omgn.com/gamesdirectory/9.html</a><br /><br />Try them and see... I'm thinking it may be something in my PHP script, but I wouldn't know what...<!--content-->
 
Back
Top