Webmaster Forum


Go Back   Webmaster Forum > Web Development > Web Design Lobby > Coding Forum
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Coding Forum Problems with your code? Let's hear about it.

Bidding Directory   World's Leading Outsourcing Network   V7N Directory

Reply
 
LinkBack Thread Tools Display Modes
Old 04-05-2007, 03:18 PM   #1 (permalink)
Inactive
 
Join Date: 12-12-06
Posts: 70
iTrader: 0 / 0%
Latest Blog:
None

Pairodime is liked by somebodyPairodime is liked by somebodyPairodime is liked by somebody
Some help with .htaccess file and 301 Redirects

I looked over a few .htaccess Redirect tutorials - but I just did not seem to find the solution to what I think should be an easy fix.

I have a Blog installed - and the pages are indexed in search engines with /index.php?category=(value)Itemid=(value)

I am in the process of rebuilding my site. The directory structure is way diferent now. Mainly they are all static index.php pages. Now that I am on a server that has APACHE and .htaccess I want to Map my pages from the existing old site -> to my new static /index.php pages.

Example: http://www.mywebsite.com/website/ind...gory=2Itemid=3
-> www.mywebsite.com/about/(defaulting to index.php)

I am maping this out based on Itemid=(value)
ex: Itemid=3 => /about/
Itemid=4 => /portfolio/

Many thanks for any advice you might have.
Pairodime is offline  
Add Post to del.icio.us
Reply With Quote
Sponsored Links
SEO Hosting by HostGator  Advertise Here  Buy Blog Links
Old 04-11-2007, 08:54 PM   #2 (permalink)
Contributing Member
 
Arenlor's Avatar
 
Join Date: 01-02-07
Location: PA, USA
Posts: 194
iTrader: 0 / 0%
Latest Blog:
None

Arenlor is liked by somebodyArenlor is liked by somebodyArenlor is liked by somebodyArenlor is liked by somebody
Send a message via ICQ to Arenlor Send a message via AIM to Arenlor Send a message via MSN to Arenlor Send a message via Yahoo to Arenlor
I don't know .htaccess but I know it'd take what I believe is called the rewrite module or something along that line, but it can be done in php through using
PHP Code:
$cat $_GET['category'];
$id $_GET['Itemid'];
if(
$id != '' || $cat != ''){
header("Location:index.php");

That SHOULD work, and I'm sure someone will be along shortly to show you the .htaccess.
__________________
Need a page made? Draw a diagram, I suggest using Paint, show the picture with your post, it'll help a lot more than you think. Other questions? Draw a diagram for that too!
Arenlor is offline  
Add Post to del.icio.us
Reply With Quote
Old 04-12-2007, 09:33 AM   #3 (permalink)
Contributing Member
 
exam's Avatar
 
Join Date: 04-20-06
Posts: 333
iTrader: 0 / 0%
Latest Blog:
None

exam is a highly respected web proexam is a highly respected web proexam is a highly respected web proexam is a highly respected web proexam is a highly respected web proexam is a highly respected web proexam is a highly respected web proexam is a highly respected web proexam is a highly respected web proexam is a highly respected web proexam is a highly respected web pro
Are you using Wordpress or another blog software?
exam is offline  
Add Post to del.icio.us
Reply With Quote
Old 04-12-2007, 11:54 AM   #4 (permalink)
Inactive
 
Join Date: 12-12-06
Posts: 70
iTrader: 0 / 0%
Latest Blog:
None

Pairodime is liked by somebodyPairodime is liked by somebodyPairodime is liked by somebody
"Are you using Wordpress or another blog software?"

- Yeah, I was using Mambo - actually - it is still there, but I want to change all those pages to my new Static pages. I dont mind leaving MAMBO there as long as I can redirect each page to its new page (they have nothing in common ex: new pages are not made from MAMBO).
Pairodime is offline  
Add Post to del.icio.us
Reply With Quote
Old 04-12-2007, 11:57 AM   #5 (permalink)
Inactive
 
Join Date: 12-12-06
Posts: 70
iTrader: 0 / 0%
Latest Blog:
None

Pairodime is liked by somebodyPairodime is liked by somebodyPairodime is liked by somebody
Quote:
Originally Posted by Arenlor View Post
I don't know .htaccess but I know it'd take what I believe is called the rewrite module or something along that line, but it can be done in php through using
PHP Code:
$cat $_GET['category'];
$id $_GET['Itemid'];
if(
$id != '' || $cat != ''){
header("Location:index.php");

That SHOULD work, and I'm sure someone will be along shortly to show you the .htaccess.
Awesome! - thanks for this tip... That should work out well... I will let you know if it did the job.
Pairodime is offline  
Add Post to del.icio.us
Reply With Quote
Old 04-12-2007, 12:54 PM   #6 (permalink)
Inactive
 
Join Date: 12-12-06
Posts: 70
iTrader: 0 / 0%
Latest Blog:
None

Pairodime is liked by somebodyPairodime is liked by somebodyPairodime is liked by somebody
Quote:
Originally Posted by Arenlor View Post
I don't know .htaccess but I know it'd take what I believe is called the rewrite module or something along that line, but it can be done in php through using
PHP Code:
$cat $_GET['category'];
$id $_GET['Itemid'];
if(
$id != '' || $cat != ''){
header("Location:index.php");

That SHOULD work, and I'm sure someone will be along shortly to show you the .htaccess.
Thanks again for this tip! - It will work out perfect! I added one small addition in case somebody else came across this post for the same reason:

PHP Code:
$cat $_GET['category'];
$id $_GET['Itemid'];
if(
$id != '' || $cat != ''){
header("HTTP/1.1 301 Moved Permanently");
header("Location:index.php");

For my particular case with MABO on the backend - it made it easier to use this type of map:

PHP Code:
$id $_GET['Itemid'];
if ( 
$id == "7" ) {
    
header("HTTP/1.1 301 Moved Permanently");
    
header("Location:http://www.mywebsite.com/product/");
    exit();

Its not .htaccess - but it does exactly what I wanted.
Pairodime is offline  
Add Post to del.icio.us
Reply With Quote
Old 04-12-2007, 02:46 PM   #7 (permalink)
Contributing Member
 
Arenlor's Avatar
 
Join Date: 01-02-07
Location: PA, USA
Posts: 194
iTrader: 0 / 0%
Latest Blog:
None

Arenlor is liked by somebodyArenlor is liked by somebodyArenlor is liked by somebodyArenlor is liked by somebody
Send a message via ICQ to Arenlor Send a message via AIM to Arenlor Send a message via MSN to Arenlor Send a message via Yahoo to Arenlor
My host doesn't allow .htaccess files, so I've learned that only some things are too hard for PHP, but I'm sure if I spent time I could get those to work too, and I may try doing so soon.
__________________
Need a page made? Draw a diagram, I suggest using Paint, show the picture with your post, it'll help a lot more than you think. Other questions? Draw a diagram for that too!
Arenlor is offline  
Add Post to del.icio.us
Reply With Quote
Old 04-12-2007, 03:04 PM   #8 (permalink)
Contributing Member
 
exam's Avatar
 
Join Date: 04-20-06
Posts: 333
iTrader: 0 / 0%
Latest Blog:
None

exam is a highly respected web proexam is a highly respected web proexam is a highly respected web proexam is a highly respected web proexam is a highly respected web proexam is a highly respected web proexam is a highly respected web proexam is a highly respected web proexam is a highly respected web proexam is a highly respected web proexam is a highly respected web pro
To conform to HTTP standards, the Location header should have a space between the Location: and the URL.
exam is offline  
Add Post to del.icio.us
Reply With Quote
Go Back   Webmaster Forum > Web Development > Web Design Lobby > Coding Forum

Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Need help with .htaccess file (www. redirection) projectwealth Domain Name Forum 4 01-09-2008 06:32 AM
Need help with HTACCESS file brandnew Coding Forum 2 12-02-2007 11:13 PM
.htaccess file handling eloquent Coding Forum 6 02-01-2007 02:07 AM
Site Restructure - can I do 600 301 redirects in a .htaccess? bwb SEO Forum 2 09-28-2006 07:24 PM
.htaccess and redirects? Michael Allison Coding Forum 9 01-16-2006 07:06 AM


Sponsor Links
Get exposure! Get exposure! Find Scripts Web Hosting Directory Get exposure! SEO Blog


All times are GMT -7. The time now is 08:43 AM.
© Copyright 2008 V7 Inc