0

I'm using plogger with wordpress and I'm in the process of moving current photos to new directories. I need to setup a permanent redirect once I change the directory

For example.

Current location: www.mysite.com/products/cakes/birthday/batman-cake.html

New location: www.mysite.com/products/cakes/superhero/batman-cake.html

So if someone types in the current location it should redirect to the new location.

I have 2 .htaccess files. One in the root directory and one in the Plogger directory. the plogger one I assume is used to make the urls pretty and I think this is where I need to make the changes. Also I only want to redirect individual pages and not the entire directory

See the plogger .htaccess below.

<IfModule mod_rewrite.c>
  RewriteEngine on
  RewriteBase /products
  RewriteCond %{REQUEST_URI} !(\.|/$)
  RewriteRule ^.*$ http://www.mysite.com%{REQUEST_URI}/ [R=301,L]
  RewriteCond %{HTTP_HOST} !^www [NC]
  RewriteRule ^(.*)$ http://www.mysite.com/products/$1 [R=301,L]
  RewriteCond %{REQUEST_FILENAME} -d [OR]
  RewriteCond %{REQUEST_FILENAME} -f
  RewriteRule ^.*$ - [S=2]
  RewriteRule feed/$ plog-rss.php?path=%{REQUEST_URI} [L]
  RewriteRule ^.*$ index.php?path=%{REQUEST_URI} [L]
</IfModule>

Please note that someone set this up for me a while ago and I'm not a programmer but I'm a little technical.

Any help would be appreciated.

Thanks

1 Answer 1

0
<IfModule mod_rewrite.c>
  RewriteEngine on

  RewriteRule ^products/cakes/birthday/batman-cake.html$ /products/cakes/superhero/batman-cake.html [R=301,L]

  RewriteBase /products
  RewriteCond %{REQUEST_URI} !(\.|/$)
  RewriteRule ^.*$ http://www.mysite.com%{REQUEST_URI}/ [R=301,L]
  RewriteCond %{HTTP_HOST} !^www [NC]
  RewriteRule ^(.*)$ http://www.mysite.com/products/$1 [R=301,L]
  RewriteCond %{REQUEST_FILENAME} -d [OR]
  RewriteCond %{REQUEST_FILENAME} -f
  RewriteRule ^.*$ - [S=2]
  RewriteRule feed/$ plog-rss.php?path=%{REQUEST_URI} [L]
  RewriteRule ^.*$ index.php?path=%{REQUEST_URI} [L]
</IfModule>
3
  • I tried this but I always get a 404 page not found. There must be something missing here. The closest I can get to making this work for me is modifying the .htaccess file under the root directory as follows: Redirect 301 /products/cakes/birthday/batman-cake.html products/cakes/superhero/batman-cake.html? The problem here is that I must put the trailing "?" question mark and this Always shows up in the URL. Any other suggestions?
    – procon
    Apr 24, 2011 at 19:23
  • missed the trailing $
    – Mike
    Apr 24, 2011 at 22:08
  • Still no luck, just getting the 404 page. Any way to debug what is happening behind the scenes on my godaddy account?
    – procon
    Apr 25, 2011 at 3:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.