Forum Moderators: phranque
the pages that were a part of my blog were in this format, with a trailing slash at the end of the full url
http://www.example.com/blog/social-networking-cards/
this is what I added to my .htaccess so far:
<Files .htaccess>
order allow,deny
deny from all
</Files>
redirect 301 /blog http://www.example.com/free-graphic.htm
Since the blog no longer exists, I left the blog/ folder and an index.php inside of it, but want to delete it altogether.
I was trying to re-direct all blog traffic to one single page
www.example.com/free-graphic.htm
The snip I have above works fine for all traffic coming from the home page of my old blog to the page specified above, but when a request comes for a specific post page,
it appends part of that old post page onto the redirected url, like so:
www.example.com/free-graphic.htm/social-networking-cards/
Is there any way I can just get the /blog folder and old indexed posts to redirect to that one page if people arrive by an old indexed post url?
In other words, I hope to have any page requested from old /blog, end up on this specific page:
http://www.example.com/free-graphic.htm
I should mention that I am not very knowledgeable with .htaccess, just know enough to follow instructions.
I would greatly appreciate any advice given. Thanks!
[edited by: jdMorgan at 3:38 pm (utc) on May 9, 2008]
[edit reason] Please use example.com. [/edit]
It takes all of the stuff found after whatever you specified on the left, and appends it on the end of whatever you specified on the right.
For what you want to do, you'll need RewriteRule instead. There's plenty of prior examples here. Grab one, modify it, see how you get on, and then post your best effort back here.
I took the example:
RedirectMatch page1\.html page2.html
from the library:
[webmasterworld.com...]
and changed it like this:
RedirectMatch /blog\.php /free-graphic.htm
and it now works!
Response Headers
Date: Thu, 08 May 2008 02:40:52 GMT
Server: Apache
Last-Modified: Sun, 04 May 2008 08:54:56 GMT
Etag: "33003e-2486-481d79e0"
Accept-Ranges: bytes
Content-Length: 9350
Content-Type: text/html
200 OK
Made my changes and I changed the .html part to .php because that is what my blog used, hopefully I did that correctly, but it is acting like I wanted with no error, thanks a heap to both of you!