HTML Logo by World Wide Web Consortium (www.w3.org). Click to learn more about our commitment to accessibility and standards.

Moving forward with Composr

ocPortal has been relaunched as Composr CMS, which is now in beta. ocPortal 9 will be superseded by Composr 10.

Head over to compo.sr for our new site, and to our migration roadmap. Existing ocPortal member accounts have been mirrored.


Redirecting subdirectory htaccess

Login / Search

 [ Join | More ]
 Add topic 
Posted
Rating:
#69296 (In Topic #14677)
Avatar

Well-settled

Subdirectory to Main Directory

I have experimented with my site several times, figuring out what works and what doesn't. Google indexed quite a few links from my previous site I had and I left that old site so that I could continue returning to it and taking some of the links and other things from it. My primary site link is: http://www.youtrippy.com I used to use PHP Fusion, so most of my addons (mods) were in a directory called /infusions/ So when I search Google, I can see that there's about 2 pages that were indexed. I would like to redirect anyone going to these pages – basically anyone going to /infusions/* - to the primary site link. Instead of restricting access completely, I just want a redirect instantly. So in the .htaccess file, I've tried these without success:

Code

Redirect 301 infusions/* http://www.youtrippy.com/

Code

Options +FollowSymLinks RewriteEngine on RewriteCond %{HTTP_HOST} ^youtrippy/infusions/*\.com RewriteRule ^(.*)$http://www.youtrippy.com/$1[R=permanent,L]

Code

Options +FollowSymLinks RewriteEngine On RewriteCond %{HTTP_HOST} ^youtrippy/infusions/*\.com$ [NC] RewriteRule ^(.*)$http://www.youtrippy.com/$1[R=301,L]

Anyone know the correct code?
Back to the top
 
Posted
Rating:
#69297
Avatar

Community saint

See if this works.

Code

RewriteRule ^infusions/?(.*) http://www.youtrippy.com/ [R=301,L]

Do you have a Samsung Galaxy S / Galaxy S II ? If so, why not check out my ScreenFree FM Radio .
Back to the top
 
Posted
Rating:
#69298
Avatar

Well-settled

Works like a charm temp. Thank you.

Only other issue I see is the address bar stays the same.

So if I visit: 301 Moved Permanently

It redirects me to the primary site, but the address bar remains: 301 Moved Permanently

That should change to the primary site link too.
Back to the top
 
Posted
Rating:
#69301
Avatar

Community saint

My understanding is that the "=301" portion forces the address bar to change. If that's not the case, then I don't know what else to suggest.

Do you have a Samsung Galaxy S / Galaxy S II ? If so, why not check out my ScreenFree FM Radio .
Back to the top
 
Posted
Rating:
#69309
Avatar

Well-settled

It's alright Temp. At least it does exactly what it needs to be doing. Hated to see those 2 pages of links go to waste on Google's search engine. They come up when people type in certain types of music, so at least they'll be redirected back to the main area of the site instead of the old one. Thanks again for your help.
Back to the top
 
Posted
Rating:
#69654
Avatar

Well-settled

Having a bit of trouble with the 301 direct access command.

I originally just had the command change from non-www to adding the www.

But I've recently decided to do away with my index "intro" page and go directly into the ocPortal folder.

I'm having trouble though, as it is directing every folder I type in to that specific folder.

For example, if I have an /images/ folder where I keep all my regular images for my site, logos, banners, etc. When I type it in, it just directs me to a 404 error page.

What I want is to direct only URLs specified to lead to that specific page.

So for example, if I type in (URL parsed)
youtrippy . com -> http … www … youtrippy … social … site … index.php?page=start
www … youtrippy … com … -> http … www … youtrippy … social … site … index.php?page=start


But unfortunately, if I type in http://www.youtrippy.com/images/youtrippy_banner.gif, I get taken to this URL:

Code

http://www.youtrippy.com/social/site/index.php?page=startimages/

And the image ends up not being found.

Or if I type in another URL to a section of my site, for example: http://www.youtrippy.com/videos - a whole other section - I can't get there.


Here is the code I am using:

Code

Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP_HOST} ^www.youtrippy.com [NC]
RewriteRule ^(.*)$http://www.youtrippy.com/social/$1[L,R=301]

Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP_HOST} ^youtrippy.com [NC]
RewriteRule ^(.*)$http://www.youtrippy.com/social/$1[L,R=301]

Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP_HOST} ^http://www.youtrippy.com [NC]
RewriteRule ^(.*)$http://www.youtrippy.com/social/$1[L,R=301]


I'm sure I'm just doing writing something wrong. Anyone know how to correct this code?
Back to the top
 
Posted
Rating:
#69655
Avatar

Well-settled

Nevermind, I got it working.

The code I used and put before each of the other rules:

Code

RewriteRule ^(images|videos)($|/) - [L]
Back to the top
 
There are too many online users to list.
Control functions:

Quick reply   Contract

Your name:
Your message: