newbtophp Posted August 10, 2010 Share Posted August 10, 2010 Is their something I can do in PHP (like some sort of function/config/array etc...) which would make the following process easier (examples appreciated)... I have an .htaccess file where im rewriting urls to seo friendly ones...now in the PHP script is their something I can place for urls are meant to be displayed/linked (like some sort of placeholder) which makes it easier for me to modify the urls within the PHP script, without constantly editing countless php sourcecode to just change the url? Example scenario: Say I had a php file (called submit.php): <?php echo 'Hey! Thanks for submiting the form, <a href="submit.php?form">click here</a> to go back!'; ?> and my rewrite rule for submit.php?form was: /form How would I easily change the url within submit.php without editing submit.php directly? Quote Link to comment https://forums.phpfreaks.com/topic/210321-seo-urls/ Share on other sites More sharing options...
onlyican Posted August 10, 2010 Share Posted August 10, 2010 So you have loads of filenames, you want to change to SEO Friendly rewrites. Notepad++ and Find and Replace sorry Quote Link to comment https://forums.phpfreaks.com/topic/210321-seo-urls/#findComment-1097545 Share on other sites More sharing options...
newbtophp Posted August 10, 2010 Author Share Posted August 10, 2010 So you have loads of filenames, you want to change to SEO Friendly rewrites. Notepad++ and Find and Replace sorry I meant like is their something I can do so in the furture if I changed the way the seo urls where, I can easily change the urls within the code?, I can use variables - within a global/config file, but is their a better solution (more generic?) Quote Link to comment https://forums.phpfreaks.com/topic/210321-seo-urls/#findComment-1097559 Share on other sites More sharing options...
onlyican Posted August 10, 2010 Share Posted August 10, 2010 you mention that this is SEO purpose. SEO purpose you should not change your URLS, I rebuilt my old website, which included removing some sections. I still kept content on these pages as it had links into and good PR. But options are as follows Find and Replace each time A file containing all page names, as variables or constants SQL (Not good idea as it would be a high load on your SQL) You could even have a function which handles the page function setPageName($strPage){ switch($strPage){ case 'home': $strNewPage = '/Index/'; break; default: $strNewPage = $strPage; } return $strNewPage; } echo '<a href="'.setPageName('home').'">Go Home</a><br />'; Quote Link to comment https://forums.phpfreaks.com/topic/210321-seo-urls/#findComment-1097590 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.