Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
#1 2009-12-09 14:15:50
- beechy
- Member
- Registered: 2006-03-02
- Posts: 92
301 redirect in my .htaccess file when old url contains index.php
I want to setup some 301 redirect in my .htaccess file as I have moved to textpattern from another CMS system.
At the moment I am using:
redirect 301 /index.php?option=com_news_portal&task=category&id=31&Itemid=117 http://www.mysite-url/news/
However this does not work. I think it is something to do with the RewriteRule ^(.*) index.php also in the .htaccess file.
If I remove the /index.php? the redirect works. How can I get the redirects I have setup to ignore the RewriteRule ^(.*) index.php rule.
I had a look around the forum and this post was the closest I could get to a solution but it didn’t seem to of been solved.
http://forum.textpattern.com/viewtopic.php?id=16298
Last edited by beechy (2009-12-10 11:50:17)
Offline
#2 2009-12-10 11:49:28
- beechy
- Member
- Registered: 2006-03-02
- Posts: 92
Re: 301 redirect in my .htaccess file when old url contains index.php
Can anyone offer any help on this?
Offline
#3 2009-12-15 13:40:34
- beechy
- Member
- Registered: 2006-03-02
- Posts: 92
Re: 301 redirect in my .htaccess file when old url contains index.php
Are there any .htaccess gurus who can help me out on this???
Offline
#4 2009-12-16 11:19:57
- beechy
- Member
- Registered: 2006-03-02
- Posts: 92
Re: 301 redirect in my .htaccess file when old url contains index.php
after some hunting on google I found the following code:
RewriteCond %{REQUEST_URI} /index\.php
RewriteCond %{QUERY_STRING} option=com_news_portal&task=category&id=31&Itemid=117
RewriteRule ^(.*)$ http://www.mysite.com/news/?c=name-of-cat [L,R=301]
RewriteCond %{REQUEST_URI} /index\.php
RewriteCond %{QUERY_STRING} option=com_content&task=view&id=145&Itemid=133
RewriteRule ^(.*)$ http://www.mysite.com/section/article-title? [L,R=301]
- notice the extra “?” at the end of the second redirect.
This works and doesn’t seem to interfer with anything, can anyone confirm that this will not cause any conflict with the other rewrite rules in the textpattern .htaccess file
Last edited by beechy (2009-12-16 11:20:27)
Offline