...

.htaccess Rewrite help

ubh
01-15-2009, 08:10 PM
Hi, ok so I have designed a new site and its located in my main directory under a folder called "new_site" so my url to the new site is as follows:


http://www.mysite.com/new_site/index.php

I have used .htaccess files to rewrite urls that are passing variables with in the url to a more SEO friendly url. My questions is can I use a .htaccess file to strip out the /new_site/ from the url instead of having to migrate the new site out of this folder and spend days finding and changing all the links images and database content that carry /new_site/ in it.

Any ideas?

Thanks.

oesxyl
01-15-2009, 11:08 PM
Hi, ok so I have designed a new site and its located in my main directory under a folder called "new_site" so my url to the new site is as follows:


http://www.mysite.com/new_site/index.php

I have used .htaccess files to rewrite urls that are passing variables with in the url to a more SEO friendly url. My questions is can I use a .htaccess file to strip out the /new_site/ from the url instead of having to migrate the new site out of this folder and spend days finding and changing all the links images and database content that carry /new_site/ in it.

Any ideas?

Thanks.

if you use apache 2 this will help you:

http://httpd.apache.org/docs/2.2/rewrite/rewrite_guide.html

using redirection in general is not a good idea and in your case is more simple to use some tools to automate the proccess of changing url in your code.
Usualy you don't have this problem if you keep in mind that problem when you design your code. The simplest way is to use relative uri to the root document.

best regards

ubh
01-15-2009, 11:27 PM
Hmm, ok so I can simply tell my root dir "/" to be redirected to /new_site/.

But how do I remove all traces of /new_site/ from my url is the million dollar question.

oesxyl
01-15-2009, 11:45 PM
Hmm, ok so I can simply tell my root dir "/" to be redirected to /new_site/.

But how do I remove all traces of /new_site/ from my url is the million dollar question.
find some tools you can use, you feel confortable with, for search and replace in multiple files inside a tree directory.. This will also help you to change spaces to - or _.
I don't use windows and usualy I don't use visual tools so I can't recommand something and probably command line tools don't help you. I'm sorry. For me, using my tools is a few minutes task and I guess same thing is true if you find a proper tool for you.

best regards



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum