PDA

View Full Version : [RESOLVED]Do I need a rewrite?


FWDrew
11-01-2009, 10:00 AM
Hey Everyone,

I come to you with what I think is a reason to use .htaccess or some kind of rewrite. I admit upfront that my knowledge on this topic is limited.

Here's what I got:

I'll be moving a clients entire website and blog system to a different location on his server. Right now he has blog posts like so:

http://www.clientssite.com/blog/2009/10/26/r-i-p-geocities/

When the move is made, the URL will now look like this:

http://www.clientssite.com/2009/10/26/r-i-p-geocities/

Is there a way to detect the blog section of the URL, and remove/rewrite it to redirect to the address without blog in the URL? Does what I'm asking make sense?

I would appreciate any tips or links that could help me out.

-Drew

abduraooft
11-01-2009, 12:17 PM
Have a try by adding a rule in your .htaccess file like
RewriteRule ^blog/(.*)$ http://%{HTTP_HOST}/$1 [R=301,L]


Is there a way to detect the blog section of the URL, and remove/rewrite it to redirect to the address without blog in the URL? Does what I'm asking make sense? Which is your blog engine - wordpress? If so, I think there's an option to change the url under "permalinks"

FWDrew
11-01-2009, 12:55 PM
Have a try by adding a rule in your .htaccess file like
RewriteRule ^blog/(.*)$ http://%{HTTP_HOST}/$1 [R=301,L]


Which is your blog engine - wordpress? If so, I think there's an option to change the url under "permalinks"

I'll give that a try, thanks abduraooft :)

Yes it is WordPress, I already had the idea of changing the permalinks to contains blog, but this will cause problems with other blog posts, with the way I have the client taking advantage of posts. Basically, changing the permalinks to include blog isn't an option.

I'll try this soon and get back to you, thanks again.

FWDrew
11-02-2009, 05:52 AM
Hey abduraooft,

That worked wonderfully thanks. However, I come to you in need of another rewrite help.

I have a URL like so:

http://blog.clientsites.com/files/geocities.jpg

Which I would like to redirect to:

http://clientsites.com/files/geocities.jpg

Any idea or pointers on how to go about doing this?

EDIT - Nevermind, I figured everything out. I just put an .htacess file in the blog.clientssites.com folder and redirected where I needed to.

Thanks again!

oesxyl
11-02-2009, 10:05 AM
Hey abduraooft,

That worked wonderfully thanks. However, I come to you in need of another rewrite help.

I have a URL like so:

http://blog.clientsites.com/files/geocities.jpg

Which I would like to redirect to:

http://clientsites.com/files/geocities.jpg

Any idea or pointers on how to go about doing this?

EDIT - Nevermind, I figured everything out. I just put an .htacess file in the blog.clientssites.com folder and redirected where I needed to.

Thanks again!
you get it wrong. You don't need any redirection, blog is a subdomain of clientsites.com, like anything is before clientsites.com( for example www, :)), so all you need is to add a subdomain and put wordpress there.
And also it can have any subdomain name you want, blog is just a name, :)

best regards

FWDrew
11-02-2009, 11:56 AM
you get it wrong. You don't need any redirection, blog is a subdomain of clientsites.com, like anything is before clientsites.com( for example www, :)), so all you need is to add a subdomain and put wordpress there.
And also it can have any subdomain name you want, blog is just a name, :)

best regards
I'm aware of what you mean, but thank you :)

It's really a complicated project and thing to explain (I have trouble describing it all in type), but it's all figured out now, I didn't need to use a rewrite for the second example.