homepage Welcome to WebmasterWorld Guest from 54.166.84.82
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Pubcon Platinum Sponsor 2014
Home / Forums Index / Code, Content, and Presentation / Apache Web Server
Forum Library, Charter, Moderators: Ocean10000 & incrediBILL & phranque

Apache Web Server Forum

    
Redirect help
GeneralOJB



 
Msg#: 4287649 posted 11:45 pm on Mar 25, 2011 (gmt 0)

Ok, Simply:

I want domain.com/1/ to direct to domain.com/2/

but also domain.com/1/subdir.php to redirect to domain.com/2/subdir.php

and domain.com/1/blah.jpg to redirect to domain.com/2/blah.jpg

So on and so forth.

I'd be very greatful if you could help me.

 

GeneralOJB



 
Msg#: 4287649 posted 1:22 am on Mar 26, 2011 (gmt 0)

Come on... I chose this forum as it was active ( I thought )

g1smd

WebmasterWorld Senior Member g1smd us a WebmasterWorld Top Contributor of All Time 10+ Year Member



 
Msg#: 4287649 posted 2:50 am on Mar 26, 2011 (gmt 0)

Hmm. 97 minutes must be a record for a "write my code for me NOW" post in this forum.

Do you really mean "redirect"? Are you sure? (The other choice is "rewrite").

What code have you tried? There are at least twenty thousand threads with redirect examples in this forum.

There's an emphasis here, on YOU learning to code this stuff with help. There isn't a free code writing service that works to your calling.

As it is ten to three in the morning here (sunrise in three hours), I'm off to bed.

wilderness

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



 
Msg#: 4287649 posted 3:09 am on Mar 26, 2011 (gmt 0)

Forum Charter [webmasterworld.com]

It is not appropriate to expect other members to write your code for you or to debug your entire project; Please don't expect other members to solve a problem you don't want to begin solving yourself.

Before posting a new thread, please try looking through the older posts in the forum index. Someone may have recently asked the same question, and you may benefit from the posted answers. Using the WebmasterWorld search function or the site-specific search feature of major search engines may help you find exactly what you are looking for on WebmasterWorld.

Please describe your server environment and include whatever research and testing you've done so far. This will help the members who are willing to help you, and increase their number, too. Better, more-detailed questions get faster, better, and more-detailed answers, since the other members won't have to ask you for more information.

"Fix my code" and "Do my homework for me" threads:

This is a discussion forum, not a help desk or a free code-writing service; If you have a problem, please try to research it and then phrase your post in a manner conducive to general discussion of the issue. Rather than providing one-off solutions, we prefer to help people find resources to help themselves.

A general guideline for code-related problems is: Post your own code and describe what you hoped it would accomplish. Then describe how it fails and include all relevant information from your server error logs. Too-general posts in the form of "What code do I use to do this?" often go unanswered for a long time.

The following resources are often referenced in our Apache forum, and may help to answer or focus your questions.

See links at page bottom.
You will also find useful expanations in the Forum Library [webmasterworld.com]

GeneralOJB



 
Msg#: 4287649 posted 1:40 pm on Mar 26, 2011 (gmt 0)

Bamp. Don't bother replying if you're gonna be a jerk-ass like the #*$!twits above. If you don't know the answer to my question, it's fine, just move on.

Quadrille

WebmasterWorld Senior Member quadrille us a WebmasterWorld Top Contributor of All Time 10+ Year Member



 
Msg#: 4287649 posted 4:38 pm on Mar 26, 2011 (gmt 0)

The OP must have disabled his forum search facility, or maybe didn't actually read the posts above. Sad, really.

wilderness

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



 
Msg#: 4287649 posted 5:43 pm on Mar 26, 2011 (gmt 0)

It's quite typical of newcomers in this forum (and most others at Webmaster World) to NOT take the time to read TOS, Individual Forum Charters, or individual forum libraries, the later two of which provide accumulated answers to the most frequently asked questions (such as this OP).

BTW, this is one of the simplest redirects/rewrites for any webmaster, there are literally tens of thousands of references available (not just here at Webmaster World).

youfoundjake

WebmasterWorld Senior Member 5+ Year Member



 
Msg#: 4287649 posted 6:25 pm on Mar 26, 2011 (gmt 0)

Heeh. To the OP's credit, he did use domain.com and not his actual domain.

Quadrille

WebmasterWorld Senior Member quadrille us a WebmasterWorld Top Contributor of All Time 10+ Year Member



 
Msg#: 4287649 posted 6:43 pm on Mar 26, 2011 (gmt 0)

From his POV, another mistake?

jdMorgan

WebmasterWorld Senior Member jdmorgan us a WebmasterWorld Top Contributor of All Time 10+ Year Member



 
Msg#: 4287649 posted 12:44 pm on Mar 28, 2011 (gmt 0)

The important question --and one that is so far unanswered-- is whether an external redirect or an internal rewrite is required, and secondarily, whether the different search ranking effects of these two approaches has been considered (or is even recognized).

Using a redirect when an internal rewrite is more appropriate will result in loss of search ranking -- anywhere from a few days up to many, many months. So the "answer" is not at all just a simple matter of posting one to three lines of code...

Jim

aakk9999

WebmasterWorld Administrator 5+ Year Member



 
Msg#: 4287649 posted 11:38 pm on Apr 28, 2011 (gmt 0)

Am I right to conclude that from the OP question it is not possible to detect whether they would need external redirect or internal rewrite?

I believe I understand the difference quite well, but g1smd answer threw me a bit.

Without extra background information, that is, without knowing whether the OP wants to serve the previously existing resource under a new URL or they just want for the existing URL to grab a different resource on the server it is not possible to conclude whether the external redirect is required or internal rewrite. Or am I missing something?

EG. If I have a resource that on the server can be found under a dynamic URL (actual path/filename/params) www.example.com/somepage.php?someparam=something and I want to serve this resource under a "friendly" URL www.example.com/something-new then:

1. External requests for a dynamic URL should respond with 301 redirect to the new "friendly" URL
2. External requests for "friendly" URL would be internally rewritten to dynamic URL in order to serve the resource (where the URL the client/browser requested remains the requested "friendly" URL in the address bar)

Throwing in a third possibility, where there is an "old" "friendly" URL for this resource, which I want to replace with a new "friendly" URL then:

3. External request for the old "friendly" URL should respond with 301 to a new "friendly" URL

g1smd

WebmasterWorld Senior Member g1smd us a WebmasterWorld Top Contributor of All Time 10+ Year Member



 
Msg#: 4287649 posted 12:30 am on Apr 29, 2011 (gmt 0)

Yes, those things are true as you have stated them, but sometimes people have
- moved the content around in the server to different folders and want to continue using the old URLs,
- moved the content around in the server to different folders have new URLs for everything and want to redirect traffic asking for old URLs to the new URLs,
- have the same content inside the server, but want a new URL scheme to access that content, with redirects from the old URLs to the new URLs,
- and a myriad of other combinations.

Sometimes it is just .php/.html extensions involved, other times there are parameters and/or SEF URLs too.


The original question was unclear. People often put rewrite when they mean redirect, and vice versa so it is not worth trying to guess.

The main problem was simply posting a question at a quarter to midnight and then demanding a response just 97 minutes later.

It would have taken way less than half of that time in order to find the answer in a previous thread in this forum.

aakk9999

WebmasterWorld Administrator 5+ Year Member



 
Msg#: 4287649 posted 1:11 am on Apr 29, 2011 (gmt 0)

Thanks for your response and clarification - and it arrived in 52 min ;-)

Your various examples are valid but I tend to look at this very simplistically:

- After the request - should the URL you see in the browser change (needs redirect)
- Or URL in the browser should stay the same, but the content is coming from a physical server path/filename/params not equal to URL requested (needs internal rewrite)

Now, to set this up to work properly is a different matter!

g1smd

WebmasterWorld Senior Member g1smd us a WebmasterWorld Top Contributor of All Time 10+ Year Member



 
Msg#: 4287649 posted 4:51 pm on Apr 29, 2011 (gmt 0)

Yes, those are perfectly good explanations of what happens.

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