Menu Content

Podpora

> Diskusní fóra, FAQs & placená podpora
Welcome, Guest
Username Password: Remember me

Generating redirect 301
(1 viewing) (1) Guest
Support forum for customers who have purchased JoomSEF 3 (Joomla 1.5 compatible). Archive only, no new post can be added.

NOTE: This category has been locked. If you have purchased paid version, please, use our Support Ticket system instead. If you are using free edition, please see the Community Support section.
  • Page:
  • 1

TOPIC: Generating redirect 301

Generating redirect 301 15 years, 2 months ago #7945

  • y2ksw
  • OFFLINE
  • Joomla: latest; JoomSEF: latest
  • Posts: 20
I need to generate manually redirects (301).

After migration of a portal to Joomla, I have thousands of old URL's to insert in the sefmoved table. The problem I encounter are the missing entries in the sefurls table, since those seem to be inserted on the fly.

My initial idea was to"click" the pages by using the Joomla URL, e.g.:

$url = "index.php?option=com_content&catid=$rs[catid]&id=$rs[id]&view=article";

with cURL, but this seems not to insert the URL. If it would work, it would be an excellent solution in order to avoid "understanding" JoomSEF. With the help of the new entries I would then have filled properly the sefmoved table.


Question:
- How to I create a new entry in the sefurls table from a PHP script without getting mad?

Order No. 5591
Last Edit: 15 years, 2 months ago by y2ksw.
The topic has been locked.

Re:Generating redirect 301 15 years, 2 months ago #7969

  • y2ksw
  • OFFLINE
  • Joomla: latest; JoomSEF: latest
  • Posts: 20
Ok I got it ... it's not possible. ;)
The topic has been locked.

Re:Generating redirect 301 15 years, 2 months ago #8031

  • jaku
Hi,

yes, you are right - so far JoomSEF can only handle "in-site" URL, that means URLs that are handed to Joomla to be processed. Anyway, we plan to add .htaccess editing feature to JoomSEF, so, please, stay tuned to us.
The topic has been locked.

Re:Generating redirect 301 15 years, 2 months ago #8049

  • y2ksw
  • OFFLINE
  • Joomla: latest; JoomSEF: latest
  • Posts: 20
Well, it's not 100% true. I achieved what I wanted in several steps:
  1. Insert articles in Joomla via script (saves also the import ID)
  2. Insert old URL into article alias
  3. Run a spider (JoomSEF creates new links into database)
  4. Run the following code


 
$SQL = "SELECT id, catid, import_id, `alias`
FROM jos_content
WHERE import_id>0
AND `alias`>''"
;
$rss = $db->query_read($SQL);
while($rs = $db->fetch($rss))
{
$SQL = "DELETE
FROM jos_sefmoved
WHERE old='$rs[alias]'"
;
$db->query_write($SQL);
$SQL = "SELECT sefurl
FROM jos_sefurls
WHERE origurl='index.php?option=com_content&catid=$rs[catid]&id=$rs[id]&view=article'"
;
$rs2 = $db->query_first($SQL);
if(!$rs2)
{
continue;
}
$SQL = "INSERT INTO jos_sefmoved (
old,
new
) VALUES (
'$rs[alias]',
'$rs2[sefurl]'
)"
;
$db->query_write($SQL);
}
$db->free($rss);
 


Done :)

So now if somebody types the old URL, they get the new location error free and without messing with the .htaccess file, which would be anyway very unhandy, given thousands of articles.
The topic has been locked.
  • Page:
  • 1
Přihlášení uživatele Prázdný