0
   

Need help in .htaccess?

 
 
Reply Wed 22 Oct, 2008 08:07 pm
Hi guys.
Recently, I changed my forum directory from the main site directory to a sub directory. It was www.mysite.net and now www.mysite.net/vb
For Example: I currently have

www.mysite.net/showthread.php?&threadid=259
www.mysite.net/showpost.php?p=18510&postcount=7

and I need this to got to

www.mysite.net/vb/showthread.php?&threadid=259
www.mysite.net/vb/showpost.php?p=18510&postcount=7

Can someone please let me know the syntax for this...also which directory should the htaccess file be uploaded into the root or the /vb directory..

Unfortunately, all the pages that was indexed in Google has the old link, and when someone trying to accessing my website from there he will got the old links Sad. And now Google didn't crawl my page that much, not like before, and I don't know why?
If you guys recommend for me to return to the old link (without the /vb) I will do that. at least Google was crawling my page Usually.
Thanks
  • Topic Stats
  • Top Replies
  • Link to this Topic
Type: Question • Score: 0 • Views: 1,281 • Replies: 4
No top replies

 
Robert Gentel
 
  1  
Reply Wed 22 Oct, 2008 10:27 pm
@Pianoforte,
Do you want only those urls redirected or all urls? e.g. would index.php redirect to /vb/index.php?
0 Replies
 
Nick Ashley
 
  2  
Reply Wed 22 Oct, 2008 10:34 pm
@Pianoforte,
Sorry, I don't have time to lookup the exactly syntax, and I don't have all these things memorized. I can get you headed in the right direction though.

First off, I can tell you the .htaccess file will need to be in the root directory, not the vb directory.

You will then need to make a rewriterule for each page. I believe this will work:
Code:RewriteRule showthread.php /vb/showthread.php [QSA,R=301]


If my memory is correct, this will work. The first argument (showthread.php) is what you are checking the URL against. If it matches, you send them to the second argument (/vb/showthread.php).

Lastly, you have two flags added to the end. The QSA stands for 'query string attached' and it should ensure everything after the question mark gets passed along. The second flag, R=301 tells the browser to do a permanent redirect to the new location.

Again, all this advice is out of memory, so I'm not 100% sure it will work. If not, let me know and I'll look up a proper solution when I have the time.
0 Replies
 
Nick Ashley
 
  1  
Reply Wed 22 Oct, 2008 10:35 pm
@Pianoforte,
... I see Robert came while I was writing my reply. If I am wrong, he will be able to help as well. He has been in htaccess files quite a bit...
0 Replies
 
Pianoforte
 
  1  
Reply Thu 23 Oct, 2008 03:37 am
@Pianoforte,
Thank you very much guys I really appreciate your help.
I was looking for a solution for a weak, and I finally found it Smile.
The new .htaccess file I made is:

Options +FollowSymLinks
RewriteEngine on
RewriteRule showthread.php /vb/showthread.php [QSA,R=301]
RewriteRule showpost.php /vb/showpost.php [QSA,R=301]
ErrorDocument 404 http://mysite.net/404.html
ErrorDocument 403 http://mysite.net/404.html
ErrorDocument 401 http://mysite.net/404.html

and now it's working very well.
Regards.
0 Replies
 
 

Related Topics

In How much time a website can be developed? - Question by aussiejumpingcastle
Webdevelopment and hosting - Question by harisit2005
Showing an Ico File - Discussion by Brandon9000
how to earn money in internet - Discussion by rizwanaraj
The version 10 bug. Worse then Y2K! - Discussion by Nick Ashley
CSS Border style colors - Question by meesa
There is no Wisdom in Crowds - Discussion by ebrown p
THANK YOU CRAVEN AND NICK!!! - Discussion by dagmaraka
I'm the developer - Discussion by Nick Ashley
 
  1. Forums
  2. » Need help in .htaccess?
Copyright © 2021 MadLab, LLC :: Terms of Service :: Privacy Policy :: Page generated in 0.03 seconds on 09/24/2021 at 04:16:57