Forum Moderators: phranque

Message Too Old, No Replies

Could this .htaccess rule have caused a bungled migration?

         

darkfury

4:13 pm on May 10, 2012 (gmt 0)

10+ Year Member



Hello,

I recently migrated a site of mine into a subfolder.

I redirected all of the important links individually in the .htaccess

I redirected the root domain to the subfolder using the following:

Options +FollowSymLinks
RewriteEngine On
RewriteCond %{HTTP_HOST} ^(www.)?domain.com$
RewriteRule ^(/)?$ shop [L]


The results - All new pages indexed fine, new homepage (subfolder) will not index. Is this due to the lack of [R=301,L] in my redirect?

Responses will be highly appreciated ! :)

g1smd

7:28 pm on May 10, 2012 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Just because you moved the files around on the server, doesn't mean you have to have new URLs on your site. URLs are used "out there" on the web. Files are used "here" inside the server. The two are not at all the same thing. They are merely related by the current server configuration.

By using a folder for the URLs for the old site, are you now wanting to have other sites in other folders (as seen by the URL)? If not there was no need for a redirect at all, you should have used a rewrite. A RewriteRule can be configured as a redirect or as a rewrite. They are quite different things with very similar syntax.

The code you supplied above is NOT an external redirect. It is an internal rewrite. When the URL path "example.com/" or "example.com//" is requested, the server looks for a physical file or folder on the server called "/shop"

lucy24

9:01 pm on May 10, 2012 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Is this due to the lack of [R=301,L] in my redirect?

Short answer: yes. Robots and humans have one thing in common. They don't know when they've been rewritten. If you've got a RewriteRule that says

RewriteRule /goodstuff$ /directory/otherdirectory/deepdarkdirectory/obscurename.php?day=1&time=2&foobar=544332&gizmo=789&otherquery=because-I-say-so [L]

... neither google nor your human visitors will ever know that they're not "really" visiting www.example.com/goodstuff

g1smd

9:05 pm on May 10, 2012 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



That's backwards. They'll use the URL example.com/goodstuff and that's all they know about the resorce. URLs are used "out there" on the web. They'll not know what the internal filepath really is. Filepaths are used "here" inside the server.

darkfury

9:37 pm on May 10, 2012 (gmt 0)

10+ Year Member



That makes sense! Thanks for the help, I really appreciated it.

lucy24

12:07 am on May 11, 2012 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



They'll use the URL example.com/goodstuff and that's all they know about the resource.

Isn't that what I said?

:: whine ::