Welcome to WebmasterWorld Guest from 54.196.232.162

Forum Moderators: Ocean10000 & incrediBILL & phranque

Message Too Old, No Replies

rewrite rule has me stumped

stumped on this one

     
4:14 pm on Jun 6, 2014 (gmt 0)

Senior Member

WebmasterWorld Senior Member bwnbwn is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:Oct 25, 2005
posts:3492
votes: 3


This url is in the Google index and it resolves to the home page

http://www.example.com/index.php?no_redirect=true

so I tried these 2 rules that did not redirect. This is a new url to me so I am wondering if no_redirect in the url is stopping a redirect.

I tried
Redirectmatch 301 index.php?no_redirect=true http://www.example.com/

and
rewriterule ^index.php?no_redirect=true(.*)$ http://www.example.com/$1 [r=301,nc]

Stumped. Thanks for any suggestions.
5:01 pm on June 6, 2014 (gmt 0)

Moderator from US 

WebmasterWorld Administrator 5+ Year Member Top Contributors Of The Month

joined:Dec 27, 2006
posts:2570
votes: 48


The plain old rewrite that people use to take care of www is taking it to the home page. (I'm assuming that you have something like this in place for that www?):
RewriteCond %{HTTP_HOST} ^example\.com$ [NC]
RewriteRule ^(.*)$ http://www.example.com/$1 [R=301,L]

If you redirect that to another page called /index.php you could cause a server error by looping.
5:26 pm on June 6, 2014 (gmt 0)

Senior Member

WebmasterWorld Senior Member bwnbwn is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:Oct 25, 2005
posts:3492
votes: 3


after reviewing more info, this is a mobile redirect issue, so the advice is to add it in WMT under parameters and select used for tracking then add to robots file to block indexing.

BTW I discovered another url to redirect.

I have index.php redirected and found a person linking to
index.php/ this one resolved so I added it to the be redirected as well.

I assumed it is a joomula deal never had to do this before so I just tested few other sites and it resolves for them as well. One was a php and one was a index.aspx/
6:00 pm on June 6, 2014 (gmt 0)

Senior Member from US 

WebmasterWorld Senior Member lucy24 is a WebmasterWorld Top Contributor of All Time Top Contributors Of The Month

joined:Apr 9, 2011
posts:12717
votes: 244


mod_alias (Redirect by that name) won't work, because it can't see the query string. You need to convert all your redirects to mod_rewrite and use a RewriteCond looking at %{QUERY_STRING}, plus %{THE_REQUEST} if you've got behind-the-scenes rewriting going on. (I really hope this is not the case, because then you shouldn't be using mod_alias at all.)

I am wondering if no_redirect in the url is stopping a redirect.

Only if your own site's code says so.

:: wait, stop, rewind ::

I assumed it is a joomla deal

You are rewriting, then. (WordPress/ Joomla / Drupal are all based on mod_rewrite.) Don't use mod_alias.

You can go into gwt and see what parameters they've already got listed. If there are any you don't use, click the appropriate buttons.

Within your own htaccess, you can also redirect any requests using parameters you don't actually use. But it probably isn't worth the bother unless you are really infested.
7:50 pm on June 6, 2014 (gmt 0)

Senior Member

WebmasterWorld Senior Member bwnbwn is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:Oct 25, 2005
posts:3492
votes: 3


not infested only 2 so I added in WMT and set as tracking than added a wildcard disallow in text file