Codeigniter URL routing - SEO concerns - php

We have a good old website where all the pages are static and we are updating them by editing the HTML files. Every redesign is a lot of work for us since we copy and paste all the texts from old to new design. If we need to change any single thing about design, we need to change it in all other pages one by one.
Now we have developed a site by using Codeigniter and want to replace that static pages with database-driven pages. We will put all the content to the database so we will have just one product page and retrieve any product info according to the query string.
The problem is we don't want to change the old urls with the new Codeigniter urls because of search engine ranking concerns.
URLs in the old website are like these:
example.com/code1001.php
example.com/code1002.php
example.com/very-good-product-1003.php
example.com/brand-new-product.php
example.com/product-listing.php
The Codeigniter URLS in the new website are like these:
example.com/products/details/code1001
example.com/products/details/code1002
example.com/products/details/code1003
example.com/products/listing
After a quick research, I thought that I can use CI's routes.php to display database-driven pages when user/google hit to the old URL.
I can use the below code to do that.
$route['code1001.php'] = "products/details/code1001";
$route['example.com/very-good-product-1003.php'] = "products/details/code1003";
$route['brand-new-product.php'] = "products/details/1004";
$route['product-listing.php'] = "products/listing";
I don't want this to be a 301 or 302 redirect, I just want to replace the static pages with the database driven pages and leave the urls same.
Do you think that this will have a negative effect on SEO? Is Google able to notice this routing?

Best Way For dynamic routing is
$route['confirm_registration/(:any)']= "login/confirm_registration/$1";
For redirect you can use .htaccess

Related

How to redirect old URL from a custom PHP website to new WordPress URL?

I have a client that needs to rebuild their site from custom PHP website to WordPress instalation. The client run a local news site and has tons of news articles in it. Approximately more than 3000 URLs.
The old URL structure look like this:
http://localnewssite.com/news-85720-trump-is-the-king
I need to move them to the new URL like this:
https://localnewssite.com/category-name/article-title
I had two problems in here.
The first one is the old article URL has no category for each of the article, so they just use single "news" category for all of their article URLs and the article's ID number in the database despite their site has 12 news category in it.
The second is I counted approximately more than 3000 articles with that old URL style that I need to move.
I was only given the MySQL database file as the old developer refused to give any access to my clients for their own server.
My client intended to move the site to a new VPS account, so this could be tricky.
Is there any way to use regex or any HTACCESS to automatically and easily redirect 301 all of the old URLs to the new one?
I can't manually move each of the article and reconfigured all of the URL for SEO using Yoast plugin because it would take a lot of time.
Thank you.
You can either use this plugin Redirection, Or write code in htaccess to 301 redirect old urls to new urls.
Redirect 301 /old-url https://yourdomain.com/new-url

php title in URL

I'm building website in php.
For me is important to have pages with similar title and url.
Like this:
Title -> some content
URL -> some-content.php
Each page has the content (articles) retrieved from mysql. Title also is retrieved from mysql.
So my question is: should I generate a .php file for each artivle or it is possible to have one php file with changing content and URL?
How whould you do it?
Thanks for the attention
Definitly you shouldn't define new files for each article. You should have article controller in this controller you need retrieve articles from your model. In Articles you can have slug or id and pass this slug/id to template.
You could also check mod_rewrite to have nice and seo friendly urls.
Some pages to read:
http://httpd.apache.org/docs/current/mod/mod_rewrite.html
http://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93controller
http://cubiq.org/the-perfect-php-clean-url-generator
The "piles of PHP files" design pattern fell out of style over a decade ago. DO NOT DO THIS.
Modern PHP development encourages the use of a development framework like Laravel that gives you a solid foundation for building your application.
Most of these have a robust routing system that takes care of presenting clean URLs to your visitors while allowing significant flexibility in how those URLs are handled internally. This is a huge advantage to someone concerned about how their site is organized.
No need to make a PHP by page. In your html <head> you can change the title dynamically :
<head>
<title><?php echo $titleFromDB; ?></title>
</head>
Don't forget to escape/protect the variable if the title can be edit by users.
I suggest you use a framework like codeigniter which can handle the required structure of your files (MVC approach) and also helps you create SEO friendly URLs.
I would definitely use one page with a changing url, title & content. It means 1 place to go when any issues occur.
Just make 1 page and use GET variables in the url to change what content is loaded.
e.g. test-page.php?content=content-id
this link is created using the id of the content from the sql table, you then get this id when the page is opened and use it to get the rest of the details from the database that will be used for your title and content.
I hope this makes sense

Website URL rework / reformat to user-friendly

I need some advice on where and how I should start this project. The current site is running classic ASP but uses .php extensions in the file system (don't ask - previous freelance).
Current URL structure has sub folders that contains display pages that renders the page
team/team_detail.php?teamID=3&Source=Title&Title=Partner
Only the teamID part actually does anything and query the data in a team table.
I was thinking of using the IIS url rule and add user friendly rule for each matching URL patterns. I was planning to change all website code to use new structure:
url team/team_detail/3/bob-titans
Old url formant that will still work team/team_detail.php?teamID=3&name=bob-titans
Would this complete site wide URL change be the most effective way to do this or would there be another more effective method?
If your main objective is to change the URL structure of the site (and clean up stuff like the unused "Source" and "Title" parameters while you're at it), then the approach is sound:
Modify the site code to use the new URL strategy (for example, with ASP.NET Routing).
Use the IIS URL Rewrite Module to create rules to properly redirect or rewrite the old-style requests to the new format. If this is a public site, and you are concerned about SEO, you should consider making these redirects use the 301 response type to tell search engines the resources under the old URLs have moved permanently to the new URLs.
It's a nice approach because you can focus on updating your code for the new structure, and let IIS take care of any users still referencing the old URL formats.

How to make form that creates a new URL in a website?

Example, on Craigslist users complete a form of what theyre looking for and once submitted it automatically creates a new URL hosted on the website URL. Sorry i don't know how to do this or what it is called. Anyone? How can i do this and what is it called? =) Thanks!
You mean like how StackOverflow has a URL for this question?
http://stackoverflow.com/questions/12662640/how-to-make-form-that-creates-a-new-url-in-a-website
All it takes is a simple .htaccess file, something like:
RewriteEngine on
RewriteRule /questions/([0-9]+).*$ /question.php?id=$1
The whole "how-to-make..." thing is just the name of the question. I'm not entirely sure why many sites put that in the URL, possibly for SEO purposes, but it will automatically be filled in if you leave it out so I'm assuming it's optional.
This is done by a (mysql-)database, php and .htaccess resulting in dynamic url's.
A dynamic URL is a page address that results from the search of a database-driven web site or the URL of a web site that runs a script. In contrast to static URLs, in which the contents of the web page stay the same unless the changes are hard-coded into the HTML, dynamic URLs are generated from specific queries to a site's database. The dynamic page is basically only a template in which to display the results of the database query. Instead of changing information in the HTML code, the data is changed in the database.

maintain SEO of a website on platform change?

i have a site url
http://www.dualfocusphotography.co.uk
i want to convert it to word-press in such a way its SEO or site ranking should not be disturbed.
any one guide me is it possible if yes then how?
any help or relevant-materiel would be appreciated.
The main SEO issue when you try to move your site into wordpress is with the old indexed URLs by Google.
You must set "301 moved permanently status" to all of your old main urls.
You have to set an effective 404 page for error pages (WP had one).
Check for the main keywords through which people reached your site & retain those keywords. Generate new site map & submit in Google webmaster.
Migrate as quick as possible.
After migrating use WP SEO plugin & use keyword sparingly.
Use SEO friendly permalink structure.
Use twitter & facebook plugin's for socializing with virtual world.
Some useful links
https://seogadget.co.uk/surviving-seo-site-migration/
http://www.techwyse.com/blog/search-engine-optimization/5-tips-for-effective-seo-site-migration/
To keep your rankings, you should define what pages are the most important(have backlinks and are most visited and make sure you set redirects 301 on them.
There is a redirection plugin for wordpress to check for broken links. Doing redirect for all pages can affect the performance, that's why it is better to redirect the most important ones. This way you'll retain your rankings, however, a certain drop is unavoidable.
As long as you keep the same URLs, it won't matter if you are using from-scratch HTML pages or Wordpress. If you want to change the content around and will have new URLs, you'll need to do 301 redirects from each old page to each new page.
For example, the old page might have been oldsite.com/services.html, you'll do a 301 redirect to newsite.com/location/services
the 301 redirects are done in the .htaccess file.
I just wrote an article on how to SEO your wordpress site that might help you as well
Let me know if you need any help.
When migrating to a new CMS, try to keep your domain unchanged. If that's not possible, you should set up 301 permanent redirect to the following pages: homepage, most popular pages that get lots of traffic (check your analytics for them), pages with backlinks.
Also, when you change the URL structure, try to include your keywords
into the address
Check your robots.txt file - whether it;s indexing correctly
Generate the new xml sitemap and submit it via google webmaster
tools.
WordPress has it's own powerfll plugins for SEO. I suggest you use those.

Categories