3

i have a url like this http://example.com/blog/photos/photos/gallery/image/1.

And i need to remove the second photos folder. How do i remove the part using mod_rewrite and .htaccess?

For your interest /blog is my document root.

Thanks a lot for any suggestions, Steve

EDIT

You should know that the URLs being generated by Wordpress 3.0 und NextgenGallery.

http://example.com/blog is my document root. That means i have installed Wordpress into the folder blog.

The first slug after blog is the page i have my gallery associated with.

The second slug is the name of the album and could be renamed to everything you want. It is just a placeholder for my galleries. gallery is the name of the gallery.

1 Answer 1

6

Assuming you want to do a redirect:

RewriteRule ^/blog/photos/photos/(.*)$ /blog/photos/$1 [R] 
Sign up to request clarification or add additional context in comments.

5 Comments

+1. BTW since I'm learning mod_rewrite what's '[R]' why didn't you use '[301,L]' permanent redirect?
R just stands for redirect. Look at all the options here to figure out what is correct for your scenario: httpd.apache.org/docs/2.0/mod/mod_rewrite.html#rewriterule
Taylor, thank you for your fast response. But i really don't know if a simple redirect solves the problem. See my edit above please... Any further suggestions? Steve
Why do you think it doesn't solve the problem? Your edit doesn't really explain what you think the problem is that clearly.
Taylor, you're right. I can't explain why it did not work but now it works. I'm pretty sure something went wrong with my cms configuration. Now everything is fine :) Thank you very much.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.