Goldeneye Posted January 1, 2010 Share Posted January 1, 2010 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. Quote Link to comment https://forums.phpfreaks.com/topic/186869-is-there-an-easier-way-where-i-dont-have-to-edit-all-my-scripts-to-rewriting/ Share on other sites More sharing options...
chmpdog Posted January 3, 2010 Share Posted January 3, 2010 you need to go into further detail on how your scripts works. Post some code. Quote Link to comment https://forums.phpfreaks.com/topic/186869-is-there-an-easier-way-where-i-dont-have-to-edit-all-my-scripts-to-rewriting/#findComment-987366 Share on other sites More sharing options...
trq Posted January 3, 2010 Share Posted January 3, 2010 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. Quote Link to comment https://forums.phpfreaks.com/topic/186869-is-there-an-easier-way-where-i-dont-have-to-edit-all-my-scripts-to-rewriting/#findComment-987367 Share on other sites More sharing options...
Goldeneye Posted January 3, 2010 Author Share Posted January 3, 2010 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). Quote Link to comment https://forums.phpfreaks.com/topic/186869-is-there-an-easier-way-where-i-dont-have-to-edit-all-my-scripts-to-rewriting/#findComment-987571 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.