URL rewirte and redirect problem

3 replies
Hello


I am try to redirect my dynamic URL to static URL.
I write some code in .htaccess

My .htaccess code

Options +FollowSymLinks
RewriteEngine on
RewriteRule bollywood-film-(.*)-(.*)\.html$ bollywood-film-page.php?film_id=$1&film_name=$2


My dynamic URL is

aamir [2008] | zziapex[2008]

and after rewrite my URL
is

aamir [2008] | zziapex


but now problem is
i am not able to redirect my dynamic URL to static URL
i am using this code to redirect my URL

$fack_URl = "bollywood-film-".$film_id . "-" .$film_name. ".html";
header("Location: $fack_URl");

can one help me?
to redirect my dynamic URL to static URL
#problem #redirect #rewirte #url
  • Profile picture of the author Nathan Joshua
    Redirects using the PHP header from dynamic to static does work in some cases. However, most of the time this issue cannot be fixed with one line of code to suit all.

    This may help Setting Up 301 Redirects for Dynamic URLs| seOverflow
    {{ DiscussionBoard.errors[5971833].message }}
  • Profile picture of the author phpg
    This problem could have different causes, e.g. header placed after some output or some control structure preventing its' execution. Post complete code of the page you are trying to redirect, not just 2 lines.
    {{ DiscussionBoard.errors[5974213].message }}
    • Profile picture of the author Earnie Boyd
      Originally Posted by phpg View Post

      This problem could have different causes, e.g. header placed after some output or some control structure preventing its' execution. Post complete code of the page you are trying to redirect, not just 2 lines.
      Yes and any characters before the first <?php is considered to be output.
      Signature
      {{ DiscussionBoard.errors[5975674].message }}

Trending Topics