Jump to content

SEO Urls


newbtophp

Recommended Posts

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?

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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 />';

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.