homepage Welcome to WebmasterWorld Guest from 54.167.41.199
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Visit PubCon.com
Home / Forums Index / Code, Content, and Presentation / Apache Web Server
Forum Library, Charter, Moderators: Ocean10000 & incrediBILL & phranque

Apache Web Server Forum

    
Hidden rewrite rule.
sixander




msg:4602459
 2:20 pm on Aug 16, 2013 (gmt 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?

 

phranque




msg:4602586
 9:01 pm on Aug 16, 2013 (gmt 0)

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://...

lucy24




msg:4602607
 9:48 pm on Aug 16, 2013 (gmt 0)

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?

phranque




msg:4602693
 5:46 am on Aug 17, 2013 (gmt 0)

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.

lucy24




msg:4602700
 6:10 am on Aug 17, 2013 (gmt 0)

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::

phranque




msg:4602713
 8:01 am on Aug 17, 2013 (gmt 0)

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.

lucy24




msg:4602751
 10:44 am on Aug 17, 2013 (gmt 0)

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 :)

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / Apache Web Server
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved