1
dickinsd
Can I use a .htaccess like this?
  • 2005/12/7 20:35

  • dickinsd

  • Quite a regular

  • Posts: 278

  • Since: 2004/11/14


I am trying to use the .htaccess file to permanently forward URL requests for my articles.

I currently have duplicates of the content so that the search engines etc can find the material they have already referenced.

However I have read that search engines do not like duplicate content.

I am trying to use a .htaccess file to redirect individual articles.

# main (top-level) .htaccess file..
Options +FollowSymlinks
rewriteengine on
rewriterule 
/modules/articles/article.php?id=/modules/AMS/article.php?storyid=[r=301,nc]

I have tried placing this file in my root dir and my articles dir but neither seems to actually do anything.

I have tried using full urls also.

The redirect gets a little more complicated in that I have reorganised the articles so that the article IDs do not translate i.e. as you can see from the above example article ID 1 is now article id 2, but these changes become greater as the article numbers increase.
AND I want to continue using the articles module for about 5 existing articles and around 10 new ones, so I can't just redirect everything.

So first question, Does anyone know how to create a .htaccess to redirect dynamic pages (as I am starting to think the *php?id=* might be one of my main problems.

Second question is there another method of forwarding traffic from one module to another that would be better suited to my requirements?

Thanks for any help.

Dave

2
Rickb
Re: Can I use a .htaccess like this?
  • 2005/12/8 4:39

  • Rickb

  • Not too shy to talk

  • Posts: 118

  • Since: 2004/10/24


I am pretty sure you can not redirect dynamic pages using htaccess and man you are slowing down the performance of your site by using the htmaccess - period. If you do not have much traffic - it does not matter. If you have an htaccess file, the querry looks in each folder until it finds that file before a page is loaded. I would probably use a php script to redirect. I am also looking for a non htaccess solution.

Regards,

Rick

3
Watdehek
Re: Can I use a .htaccess like this?
  • 2005/12/8 6:56

  • Watdehek

  • Friend of XOOPS

  • Posts: 130

  • Since: 2005/2/21


Take a look at this topic.

4
highlander
Re: Can I use a .htaccess like this?
  • 2005/12/8 9:47

  • highlander

  • Not too shy to talk

  • Posts: 151

  • Since: 2004/12/5


Hi dickinsd,

It is indeed the ? in the first part which is stopping your redirect form working. Funnily enough I have been battleing with the exact same problem only days ago.

You can find the solution here : LINK

Please post your results !

greetings Highlander

[edit]p.s. WatdeHek you were up early..!! (idiot)[/edit]
So, I'm in the park wondering why frisbees get larger as they get closer when suddenly, it hits me...
www.AnimalPedigree.com

5
Watdehek
Re: Can I use a .htaccess like this?
  • 2005/12/8 10:49

  • Watdehek

  • Friend of XOOPS

  • Posts: 130

  • Since: 2005/2/21


Quote:

highlander wrote:

[edit]p.s. WatdeHek you were up early..!! (idiot)[/edit]


LOL

6
dickinsd
Re: Can I use a .htaccess like this?
  • 2005/12/8 23:36

  • dickinsd

  • Quite a regular

  • Posts: 278

  • Since: 2004/11/14


Thanks for the info highlander.

Unfortunately I was not very successful with either your info or any other .htaccess stuff I tried, even though the mod_rewite module is installed on my shared server.

However after a day of messing around, and with some tips from the guys at youngcoders.com I was able to get some if/else statements to work so that I could dictate which articles went where.

Just in case I did not make that clear earlier, I wanted to forward all incoming traffic from one module to another, however the new module allowed a couple of new features which meant I had less articles and as such it was not a straight translation from id=1 to storyid=1, using if/else statements I was able to give a 301 header and then forward individual articles to their new homes.

Thanks for the info all the same.

Dave

Login

Who's Online

206 user(s) are online (149 user(s) are browsing Support Forums)


Members: 0


Guests: 206


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Mar 31
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits