UK WEB HOSTING FORUM FOR DISCUSSION ON WEB HOSTING SERVICE AND SUPPORT
LINUX HOSTING WINDOWS HOSTING PACKAGES SHOPPING CART OSCOMMERCE ZEN CART AGORA
ECOMMERCE HOSTING ASP MSSQL FRONTPAGE HOSTING PHP MYSQL HOSTING DISCUSSION FORUM
CPANEL RESELLER HOSTING DEDICATED SERVER VPS HOSTING PLESK VIRTUOZZO
Quick Search
Your forum announcement here!

  UK Web Hosting | Dedicated Server Windows and Linux VPS Forum > Technical Support > cPanel Shared Hosting

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 04-09-2007, 21:15
new member
 
Join Date: Jul 2007
Location: UK
Posts: 9
Exclamation htaccess ReWrite Problems

Hi everyone,

I've got an .htacess that is doing some basic URL rewriting.

It looks something like this :

Code:
# ReWrite required to format URLs for search engines
RewriteEngine On

RewriteRule ^archive.html+ index.php?module=archive
It works fine. The user puts in archive.html but actually gets the results of index.php?module=archive. No problems.

As I've recently ditched Postnuke in preference for my own efforts I need to direct some of the old Postnuke style URLs to their equivalent pages in my new system.

So I added :

Quote:
redirect /index.php?module=pagesetter&tid=4 http://www.matthawkins.co.uk/index.php?itemid=56
ie I want the Pagesetter article with id=4 to actually go to my index.php page with itemid set to 56.

This doesn't work. It just gives me my homepage ... which implies that my index.php file is being run with unwanted parameter module=pagesetter and tid=4. ie no rewriting is happening at all.

Doesn't work either. But ...

Quote:
redirect /indexxxxxx.php http://www.matthawkins.co.uk/index.php?itemid=56
does.

This all implies that rewrite doesn't like redirecting URLs where the file actually exists.

How to I redirect the old Postnuke URLs which include index.php when I've already got my own index.php?

None of the help I've found on the internet mentions this. In fact most of the help implies my existing rewrites shouldn't work because I haven't escaped the . in my filenames with a \ !!

Any thoughts or suggestions would be appreciated.

Matt
Reply With Quote
  #2 (permalink)  
Old 06-09-2007, 21:59
Junior Member
 
Join Date: Aug 2007
Posts: 14
Default

redirect uses mod_alias is it turned on ?

see http://httpd.apache.org/docs/1.3/mod/mod_alias.html

I am also pretty sure it will ignore the the params that are supplied hence it will simply pass the input argument to the output which is presumably what you are seeing as both sides are index.php

I think you need to use rewrite rather redirect but I dont have access to my systems at the moment to create a test rule

tkgafs
Reply With Quote
  #3 (permalink)  
Old 06-09-2007, 22:49
Junior Member
 
Join Date: Aug 2007
Posts: 14
Default

Try something like the following

rewriteCond %{query_string} module=pagesetter&tid=4
rewriteRule ^index\.php$ /index.php?itemid=56? [R,L]



all the best

Tkgafs
Reply With Quote
  #4 (permalink)  
Old 07-09-2007, 16:31
new member
 
Join Date: Jul 2007
Location: UK
Posts: 9
Thumbs up

Thanks Tkgafs!

Code:
rewriteCond %{query_string} module=pagesetter&tid=4
rewriteRule ^index\.php$ /index.php?itemid=56 [R,L]
Worked fine. It didn't need the question mark after the '56'.

I can rebuild my list of rewrite rules and cross that job off my list.

Thanks for you time

Matt
Reply With Quote
  #5 (permalink)  
Old 12-09-2007, 08:01
ff1's Avatar
ff1 ff1 is offline
new member
 
Join Date: Apr 2007
Location: Es***, UK
Posts: 7
Send a message via MSN to ff1
Default Suggest using PHP redirect

Although this rewrite rule provides the desired results, I would actually suggest using a different approach:

It should be fairly trivial to write a PHP snippet that reads the values for module and tid, looks in your database for the relevant itemid value and then redirects using a 301 to the new url.

The reason that I suggest this is that it actually informs search engines that the page has been permenantly moved (301) to the new URL. It also presents the new url in a users browser address bar. Using the rewrite rule will show the old url in the browser address bar. The other advantage to this approach is that after a period of time (say 12-24 months), you could remove this code with little or no problems (as long as all links have been updated). Your rewrite rule solution will need to be a permenant fixture of your website hosting to continue to satisfy the search engines.

If you really are happy with the previous proposed solution, then stick with it. But, IMHO, that would not be the best long term approach.

Hope that provides some food for thought.
__________________
ian

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
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

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


All times are GMT. The time now is 06:58.

 

Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
LinkBacks Enabled by Web Hosting 3.1.0
Copyright © 2001-2008, eUKhost.com. All rights reserved.

 
Site Map

VPS Hosting
VPS Hosting plans

Dedicated Server Hosting
Dedicated Server plans

Business Web Hosting
100% uptime Hosting

Cpanel Hosting
cPanel Shared Hosting

Reseller Hosting
Reseller Web Hosting

Windows Hosting
Windows Shared Hosting

Windows VPS

Windows VPS Hosting

Semi Dedicated Servers
Semi-Dedicated Hosting

Dedicated Server Mirroring
Dedicated Server Mirroring

Webhosting Knowledgebase
Frequently asked Questions

Web Hosting Blog
eUKhost Blog

Web Hosting Support
Support Helpdesk

UK Data Center
eUKhost Datacenter

Web Hosting Forum
eUKhost Forum

Support Tutorials
Online Flash Tutorials

Offsite Back-up Plans
Remote Backup Service

Customer Testimonials
eUK Customer Testimonials


knowledgebase articles

eUKhost.com Services

Pre-Sales Questions
Pre-sales FAQ's

Domain Names
Domain registration FAQ's

cPanel Hosting
cPanel Hosting FAQ's

Windows Web Hosting
Plesk Control Panel

Reseller Hosting
Reseller Hosting FAQ's

VPS Hosting
Virtual Private Server

Semi-Dedicated Servers
Semi-Dedicated FAQ's

Dedicated Servers
Dedicated Server Hosting


popular blog categories


Web Hosting
Website Hosting articles

UK Web Hosting
UK Hosting articles

Dedicated Server Hosting
Dedicated Server guidelines

VPS Hosting
VPS hosting articles

cPanel Hosting
cPanel Hosting articles

Linux Operating System
Linux Operating techniques

Windows Web Hosting
Windows plesk articles