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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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).

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.