0

I'm trying to redirect my old site (http://festival.launch.co) to the new site (http://events.launch.co/festival). However, there is one subdirectory (2013) that I don't want to redirect.

To summarize:

  • festival.launch.co => events.launch.co/festival
  • festival.launch.co/2013/ => Do Nothing for all files in this subdirectory

I've tried the following and this does not redirect anything:

RewriteEngine On
RewriteCond %{HTTP_HOST} ^festival\.launch\.co$ [NC]
RewriteCond %{REQUEST_URI} !^/2013
RewriteRule ^(.*) http://events.launch.co/festival/$1 [R=301,L]

I've double-checked that mod_rewrite is enabled.

Currently, I'm redirecting everything:

Redirect 301 / http://events.launch.co/festival

Suggestions on how to do this properly?

1 Answers1

0

Try using this code:

Options +FollowSymLinks -MultiViews
RewriteEngine On
RewriteCond %{HTTP_HOST} ^festival\.launch\.co$ [NC]
RewriteCond %{REQUEST_URI} !^.*/2013/.*$
RewriteRule ^ http://events.launch.co/festival%{REQUEST_URI} [R=301,L]
anubhava
  • 761,203
  • 64
  • 569
  • 643
  • Just tried it and unfortunately it did not redirect anything. So frustrating! Any ideas as to why? – JasonDemant Sep 18 '13 at 20:03
  • Nothing redirects when I used this. So, festival.launch.co, just stayed there. I put the original 301 redirect back as it's better for us to redirect everything than nothing. (This site is live). – JasonDemant Sep 18 '13 at 23:39
  • Is mod_Rewrite enabled? – anubhava Sep 19 '13 at 03:08
  • Yes, I've double-checked that. – JasonDemant Sep 19 '13 at 15:18
  • I just opened `http://festival.launch.co` and it got redirected to `http://events.launch.co/festival` – anubhava Sep 19 '13 at 15:32
  • Also can you post your complete & latest `.htaccess` in your question again? Do you have any other .htaccess anywhere like in 2013? – anubhava Sep 19 '13 at 15:34
  • After your suggestion didn't work, I changed the .htaccess back to this: Redirect 301 / http://events.launch.co/festival. Which is why it's redirecting now. – JasonDemant Sep 19 '13 at 15:35
  • The .htaccess I have now is: AddHandler php-stable .php AddHandler php-script .html Redirect 301 / http://events.launch.co/festival – JasonDemant Sep 19 '13 at 15:36
  • Just looked 2013 and I don't see any other .htaccess files. Rather sure the only one I have is the one in the root directory. Thank you for all of the assistance by the way! – JasonDemant Sep 19 '13 at 15:37
  • Ok made an edit, replace your 301 rule with this one. Also make sure to clear your browser cache since 301 is cached by browser. – anubhava Sep 19 '13 at 15:38
  • Just noticed your comment above. Should I have the .htaccess in the 2013 folder as well? – JasonDemant Sep 19 '13 at 15:39
  • No you don't need .htaccess in 2013? Just try latest code in root .htaccess – anubhava Sep 19 '13 at 15:39
  • I just changed it to the above (go to festival.launch.co to see it). It's not redirecting anything unfortunately. – JasonDemant Sep 19 '13 at 15:43
  • Hmm that's rght, it doesn't redirect. Can you comment `RewriteCond` and then let us retest. – anubhava Sep 19 '13 at 15:54
  • Just did -- not redirecting. – JasonDemant Sep 19 '13 at 16:08
  • Was I supposed to comment out both RewriteCond? – JasonDemant Sep 19 '13 at 16:09
  • No only `RewriteCond %{REQUEUST_URI}` – anubhava Sep 19 '13 at 16:10
  • This is hugely weird. Looks like mod_rewrite isn't even working. Can you add this rule just below `RewriteEngine On`: `RewriteRule ^foo$ / [L,R]` – anubhava Sep 19 '13 at 16:15
  • Just added that, getting an internal error. I have to remove it, this is a live site. – JasonDemant Sep 19 '13 at 16:29
  • Was it giving internal error for URLs other than `/foo` also? – anubhava Sep 19 '13 at 16:38
  • Just an fyi -- I've put the Redirect 301 / http://events.launch.co/festival back in place for the time being. Let me know if you have any other thoughts, not sure what to do at this point. Thanks! – JasonDemant Sep 19 '13 at 16:40
  • Ok in that case recheck if mod_rewrite is enabled & working. Create a php file with the code `` and see what you get. – anubhava Sep 19 '13 at 16:47
  • Hmm I checked that and its not giving any info on Apache `Loaded Modules`. When I do that on my end I get `mod_rewrite` in Apache `Loaded Modules`. – anubhava Sep 19 '13 at 16:56
  • Check this post for verifying if mod_rewrite is enabled: http://stackoverflow.com/questions/9021425/how-to-check-if-mod-rewrite-is-enabled-in-php – anubhava Sep 19 '13 at 16:59
  • Made another edit. Try it out in .htaccess in a new temp folder under DOCUMENT_ROOT instead of main .htaccess – anubhava Sep 19 '13 at 17:14
  • I've just tried to do the mod_write SO post and unfortunately I'm not technical enough to figure it out. I don't understand where to put the first answer. And nothing happens when I try the second answer: http://testing.launch.co/mod-test.php. – JasonDemant Sep 22 '13 at 16:54
  • I've created testing.launch.co and tried the above updates. I changed 'festival' to 'testing' on line 3. Unfortunately it does not redirect anything: http://testing.launch.co. I also noticed that REQUEST was misspelled, was this intentional? – JasonDemant Sep 22 '13 at 16:57
  • So sorry, misspelling was a typo, I have just fixed it. Can you try again? – anubhava Sep 22 '13 at 17:00