Mobile app version of vmapp.org
Login or Join
Annie201

: Forcing the removal of query string on a rewrite rule I find I'm the only one coming up with bizarre behavior on my website. Now one of my extremely important links has malfunctioned. This

@Annie201

Posted in: #ModRewrite #UrlRewriting

I find I'm the only one coming up with bizarre behavior on my website. Now one of my extremely important links has malfunctioned.

This is the RewriteRule I have that malfunctioned:

RewriteRule ^m/?$ /x.php?MOBILEMODE=m&MAIN=1 [NC,L]


I then test my URLs example.com/m and example.com/m/ in CURL. example.com/m/ is processed correctly, but example.com/m takes me to a redirection page. In HTML source code, its this:

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>301 Moved Permanently</title>
</head><body>
<h1>Moved Permanently</h1>
<p>The document has moved <a href="http://example.com/m/?MOBILEMODE=m&amp;MAIN=1">here</a>.</p>
</body></html>


I'm using apache 2.2.

Is there a simple way to fix this so that example.com/m and example.com/m/ provide the expected result (of running the x.php script) instead of receiving a redirection message from apache?

I thought adding /? after m makes the slash optional and I thought this problem would only be caused by including R=301 in the options, but I guess I'm missing something?

Any ideas?

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @Annie201

1 Comments

Sorted by latest first Latest Oldest Best

 

@LarsenBagley505

Never mind. I found the answer I needed to my problem.

It turned out I also had a folder named m with the file robots.txt in it. I then removed that entire folder and now the RewriteRule works.

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme