Jump to content

htaccess redirect doesn't work

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
24 replies to this topic

#1
Guest_Jaan_*

Guest_Jaan_*
  • Guests
Hai..

I have a problem.. this is my htaccess file:

Redirect 301 /forum/index.php?/topic/114-php-and-xml/  /forum/php/31-php-xml.html

but it doesn't redirect to there.. Can you give me a solution for this..

Thank you

#2
hodge-podge

hodge-podge

    Learning Programmer

  • Members
  • PipPipPip
  • 47 posts
I could be wrong about this, but shouldn't it be
Redirect 301 /forum/index.php?/topic/114-php-and-xml/ http://yoursite.com/forum/php/31-php-xml.html 


#3
Guest_Jaan_*

Guest_Jaan_*
  • Guests
well.. my way works also but I tried:

Redirect 301 /forum/index.php?/topic/114-php-and-xml/ http://mysite.com/forum/php/31-php-xml.html

it don't work..

Redirect 301 /forum/topic/114-php-and-xml/ http://mysite.com/forum/php/31-php-xml.html

this works.. but I have some links with "index.php?"

#4
Guest_Jaan_*

Guest_Jaan_*
  • Guests
Anybody ? It's really important :(

#5
SoN9ne

SoN9ne

    Programmer

  • Members
  • PipPipPipPip
  • 129 posts
I don't use the Redirect 301 method the way you did but I think it may be worth mentioning that ? and . need to be escaped.
"Life would be so much easier if we only had the source code."

#6
Guest_Jaan_*

Guest_Jaan_*
  • Guests
Well.. I tried but it doesn't work..
If somebody fixes this problem for me.. I'll send you $5 to your paypal account..

#7
semprance

semprance

    Programmer

  • Members
  • PipPipPipPip
  • 126 posts
Hmm, I tried this:

RewriteCond %{QUERY_STRING} /topic/114-php-and-xml/
Redirect 301 /forum/index.php http://mysite.com/forum/php/31-php-xml.html


Which works, but also sends the query string to the redirect address >_<

#8
semprance

semprance

    Programmer

  • Members
  • PipPipPipPip
  • 126 posts
Think this will work:

RewriteCond %{QUERY_STRING} /topic/114-php-and-xml/
RewriteRule ^forum/index.php$ http://mysite.com/forum/php/31-php-xml.html? [L,R=301] 

You might need to escape the . in index.php as well, not sure.

#9
SoN9ne

SoN9ne

    Programmer

  • Members
  • PipPipPipPip
  • 129 posts
yup, you will need to escape the .php too
"Life would be so much easier if we only had the source code."

#10
Guest_Jaan_*

Guest_Jaan_*
  • Guests
Uuuum.. I tried:

RewriteCond %{QUERY_STRING} /topic/114-php-and-xml/
RewriteRule ^forum/index\.php$ http://mysite.com/fo...1-php-xml.html? [L,R=301]

but it doesnt work..
but remember my url is:
http://mysite.com/forum/index.php?/topic/114-php-and-xml/

and I want to redirect it to

http://mysite.com/forum/php/31-php-xml.html


#11
semprance

semprance

    Programmer

  • Members
  • PipPipPipPip
  • 126 posts
Wierd that works perfectly for me. Try putting the following at the top of your htaccess:

RewriteEngine on


#12
Guest_Jaan_*

Guest_Jaan_*
  • Guests
Posted Image

Look @ this mate.. it doesn't work :/