.htaccess help

  • ccb056
  • Graduate
  • Graduate
  • User avatar
  • Posts: 189

Post 3+ Months Ago

Hi, I'm looking for a few lines in an .htaccess file to help me do the following and include a 301 redirect

rewrite
"http://www.computerbb.org/ftopic(numvar).php"
to
"http://www.computerbb.org/about(numvar).html"

rewrite
"http://www.computerbb.org/sutra(numvar).php"
to
"http://www.computerbb.org/post-(numvar).html"

rewrite
"http://www.computerbb.org/forum(numvar).php"
to
"http://www.computerbb.org/forum-(numvar).html"

thanks
  • Anonymous
  • Bot
  • No Avatar
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

  • b_heyer
  • Web Master
  • Web Master
  • User avatar
  • Posts: 4581
  • Loc: Maryland

Post 3+ Months Ago

http://www.ozzu.com/programming-forum/quick-tip-mod-rewrite-t23460.html <-- That post I made should help, but incase it doesn't you can do something like this:

Ohh wait I see what you're doing :-P (I think). Look in the .htaccess file for something like this:

Code: [ Select ]
RewriteRule ^ftopic([0-9]+).php$ ftopic.php?var=$1 [L,NC]
//and change it to
RewriteRule ^about([0-9]+).html$ ftopic.php?var=$1 [L,NC]
  1. RewriteRule ^ftopic([0-9]+).php$ ftopic.php?var=$1 [L,NC]
  2. //and change it to
  3. RewriteRule ^about([0-9]+).html$ ftopic.php?var=$1 [L,NC]


You only need to change the first part, from the ^ to the $ to change what you type for the url to get the second part (ftopic...$1). The patern remains the same for each one.

I'm not sure how the mod does it but they might also have (.*) instead of ([0-9]+)
  • ccb056
  • Graduate
  • Graduate
  • User avatar
  • Posts: 189

Post 3+ Months Ago

what does the L and NC do?

edit, the code you supplied doesnt work
  • Scorpius
  • Proficient
  • Proficient
  • User avatar
  • Posts: 401
  • Loc: Scorpion Hole

Post 3+ Months Ago

Ok, well the 'L' stands for 'last', which would stop the rewriting process.
The 'NC' stands for 'no case', which would make a-z and A-Z be exactly the same.

Post Information

  • Total Posts in this topic: 4 posts
  • Users browsing this forum: No registered users and 74 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.