Jump to content

Is there an easier way (where I don't have to edit all my scripts) to Rewriting?


Goldeneye

Recommended Posts

Is there a way I can Rewrite URLs without having to go back into scripts and changing them to their S.E.O. equivalent? I have about 50 PHP-scripts for this site I'm working on and I do not want to have to go into each script and edit all the anchor-links and redirect-headers.

Your older style ?page=blah links should still work, but yeah, you will need to edit them ( to /page/blah ) if they are hard-coded. Its always best to do these things from the start, that way, you don't have to dig through a heap of code re-factoring.

chmpdog:

As thorpe suggested, my links are hard-coded.

<?php
     //my logout script
     if(isset($_SESSION['active']))
            session_destroy();
     header('Location: http://foo.bar/pages.php?page=index&from=logout') and exit;
?>

Those are how my links appear in my script -- they're all hardcoded like that.

 

thorpe:

I was afraid that was going to be the answer. I thought about writing a PHP script (that's automatically prepended to every php-file via .htaccess) that takes the current URL and makes it S.E.O.-friendly (replacing the questions, equal signs, and ampersands with  slashes and underscores) and then redirecting to the S.E.O. friendly URL. But I don't think that would actually make search-engines happy (as they would still retrieve the query-style links (page.php?foo=bar&twix=none).

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.