Welcome to WebmasterWorld Guest from 54.226.47.198

Forum Moderators: Ocean10000 & incrediBILL & phranque

Message Too Old, No Replies

Hidden rewrite rule.

     
2:20 pm on Aug 16, 2013 (gmt 0)

New User

joined:Aug 16, 2013
posts: 1
votes: 0


Okey so Im a bit new at this and I recently took over a site for a small business. And now I have two issues wich I think is ht access based.

Number 1. when I try to rewrite using 301 it ads a url string to the url wich #*$!s up my rewrite so either way I get a 404.
I have tried to put the 301 at the beginning of the file so that it would read those files first but and I cant seem to find the rule wich tells it to ad the string.

Number 2. I tried to ad the google author tag in the footer but for some reason the outoing link to the goolge+ account starts with www.mydomain.com wich is really wierd becaus the code clearly specifys ref plus.google.com/nnnnnnn ....might be connected with the earlier issue.

Im at a loss, anyone hade simular problems?
9:01 pm on Aug 16, 2013 (gmt 0)

Administrator

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

joined:Aug 10, 2004
posts:10562
votes: 14


welcome to WebmasterWorld, sixander!


1 -
By default, the query string is passed through unchanged.
...
When you want to erase an existing query string, end the substitution string with just a question mark.

[httpd.apache.org...]

2 - you need to specify a fully qualified url starting with the protocol - http://...
9:48 pm on Aug 16, 2013 (gmt 0)

Senior Member from US 

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

joined:Apr 9, 2011
posts:13218
votes: 348


when I try to rewrite using 301

Can't be done. Crystal ball suggests that what you're trying to do is
#1 issue a 301 (permanent) redirect
#2 using mod_rewrite

If so, the first thing you need to do is take any existing redirects done with mod_alias (Redirect by that name) and reword them to use mod_rewrite (RewriteRule by that name).

I have tried to put the 301 at the beginning of the file

At the beginning of what file? The page itself? htaccess? The config file?

I tried to ad the google author tag in the footer but for some reason the outoing link to the goolge+ account starts with www.mydomain.com wich is really wierd becaus the code clearly specifys ref plus.google.com/nnnnnnn ....might be connected with the earlier issue.

This would seem to be flat-out impossible, unless your page code is first processed by a php script that automatically adds your domain name to the front of all links. Once the page has reached the user, nothing more can happen to it. Outbound links will never see your own server.


You said you've taken over someone else's site. What level are you working at? The page code itself, or pages plus htaccess, or the whole server?
5:46 am on Aug 17, 2013 (gmt 0)

Administrator

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

joined:Aug 10, 2004
posts:10562
votes: 14


At the beginning of what file? The page itself? htaccess? The config file?


the OP mentioned "ht access", so i am assuming these directives are in the .htaccess file.

sixander, can you verify that?
please post the exemplified code that you are using for rewrites and redirects.

IMPORTANT: Please Use Example.com For Domain Names in Posts:
http://www.webmasterworld.com/apache/4452736.htm [webmasterworld.com]
This would seem to be flat-out impossible, unless your page code is first processed by a php script that automatically adds your domain name to the front of all links. Once the page has reached the user, nothing more can happen to it.


to most browsers, a url without the protocol specified looks like a relative url.
if it looks like a relative url, then the browser will request from the current hostname.
6:10 am on Aug 17, 2013 (gmt 0)

Senior Member from US 

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

joined:Apr 9, 2011
posts:13218
votes: 348


Yes, that's what I meant. If it's already got some other domain name in it-- which the OP clearly said it does-- then what browser would tack on an additional domain name? Not even MSIE would do that ::snrk::
8:01 am on Aug 17, 2013 (gmt 0)

Administrator

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

joined:Aug 10, 2004
posts:10562
votes: 14


in this case the browser would prepend not only the hostname but the current path as well.
in the browser context, it's not a hostname until you specify the protocol.
to the browser href="plus.google.com/nnnnnnn" looks like href="arbitrary.dot.separated.relative.subdirectory.name/nnnnnnn" while href="https://plus.google.com/nnnnnnn" is unambiguous.
10:44 am on Aug 17, 2013 (gmt 0)

Senior Member from US 

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

joined:Apr 9, 2011
posts:13218
votes: 348


We need a more exact reading of:
the code clearly specifys ref plus.google.com/nnnnnnn

If the link in the page code literally says
<a href = "plus.google.com/blahblah">
then yes I can seen where an unsuspecting browser would make it into
http://www.example.com/path-to-this-page/plus.google.com/blahblah
But it it says
<a href = "http et cetera
then something has gone bonkers :)