- Code: Select all
<?
Header( "HTTP/1.1 301 Moved Permanently" );
Header( "Location: http://www.new-url.com" );
?>
<?
Header( "HTTP/1.1 301 Moved Permanently" );
Header( "Location: http://www.new-url.com" );
?>
I have access to the file... dont know where it is...
# story_id story_url
1 /CATEGORY/1/TITLE-HERE.HTML
2 /CAT2/1/TITLE.HTML
RewriteMap storymap txt:/path/to/story.map
RewriteMap storymap prg:/path/to/story.map.program
RewriteCond %{ENV:REDIRECT_STATUS} ^$
RewriteCond %{QUERY_STRING} ^(.*&)?id=([0-9]+)(&.*)?$ [NC]
# Look it up in the storymap
RewriteCond ${storymap:%2|failed} ^(.+)$
# Make sure a URL was returned.
RewriteCond %1 !^failed$
RewriteRule ^story\.php$ %1 [R=301,L]
can we use the below code in the story.php ?
- Code: Select all
<?
Header( "HTTP/1.1 301 Moved Permanently" );
Header( "Location: http://www.new-url.com" );
?>
header('Location: http://www.example.com/', true, 301);
<?php
if(getenv('REDIRECT_STATUS') === false && isset($_GET['id']) && is_numeric($_GET['id']))
{
$id = $_GET['id'];
# Search for the category and title in the database.
$category = ...;
$title = ...;
# Redirect.
header('Location: http://www.example.com/' . $category . '/' . $id . '/' . $title . '.html', true, 301);
exit();
}
anything ?
moreover ... could we please remove my threads as I have exposed my whole htaccess here which should not have been dont ... it displays the whole site structure...
<?php
if(getenv('REDIRECT_STATUS') === false && isset($_GET['id']) && is_numeric($_GET['id']))
{
$id = $_GET['id'];
# Search for the category and title in the database.
$category = ...;
$title = ...;
# Redirect.
header('Location: http://www.example.com/' . $category . '/' . $id . '/' . $title . '.html', true, 301);
exit();
}
http://www.okidda.com/story.php?id=1403
http://www.okidda.com/opinion/1403/pakistani-ministers-and-pakistani-people-ministers.html
if(strpos($_SERVER['REQUEST_URI'], "story.php") !== false && isset($_GET['id']) && is_numeric($_GET['id']))
{
$idRR = trim($_GET['id']);
# Search for the category and title in the database.
$categoryRR = trim(strtolower($row['category']));
$titleRR = createLink(trim(htmlentities($row['title'])));
# Redirect.
header('Location: http://www.okidda.com/' . $categoryRR . '/' . $idRR . '/' . $titleRR . '.html', true, 301);
exit();
}
Return to Friendly URLs with Mod_Rewrite
Users browsing this forum: No registered users and 5 guests