co_ador — 2010-03-13T12:44:38-05:00 — #1
I would like to know what would be the steps to take and go ahead and organize your code as well?
All in a way for production server and good for the SEO?
rguy84 — 2010-03-13T15:30:10-05:00 — #2
can you clarify? Are you talking about file structure, which your title alludes to. Or do you mean the code in the files?
inclick — 2010-03-13T17:19:07-05:00 — #3
paul_wilkins — 2010-03-13T17:10:50-05:00 — #4
If you're wanting to change access to
Then you will require mod_rewrite techniques.
These techniques are not setup with PHP code, but are instead done via your server setup.
The most you will need to do in your PHP code is to update the web page links.
The Apache Configuration forum is the best place to get advice about this.
They even have a sticky thread called [mod_rewrite Resources and articles such as [url="http://articles.sitepoint.com/article/apache-mod_rewrite-examples"]Learn Apache mod_rewrite: 13 Real-world Examples](http://www.sitepoint.com/forums/showthread.php?t=183864)
co_ador — 2010-03-13T18:26:53-05:00 — #5
@rguy84 I mean both, The code in the file is what I am missing after @pmw57 and @inclick explanation on friendly urls and update the web page links as well....
I will those techniques the mod_rewrite technique and give it a try.
thank you very much.
inclick — 2010-03-13T18:33:09-05:00 — #6
This is the .htaccess code I used for PatchSales:
RewriteRule ^category/([^/])/([^/])/([^/]*)\.html$ /index.php?pageid=itemview&category=$1&page=$2&pagetitle=$3 [L]
RewriteRule ^patch/([^/])/([^/])\.html$ /index.php?pageid=itemviewdetail&detail=$1&pagetitle=$2 [L]
paul_wilkins — 2010-03-13T18:36:47-05:00 — #7
Thank you inclick, but I feel that this belongs much more appropriately in the Apache Configuration forum.
People can also find there the article called Learn Apache mod_rewrite: 13 Real-world Examples from which they can match them up to their own requirements.
oddz — 2010-03-13T19:05:43-05:00 — #8
You can also opt to make your life easy and decode the URL within the application. That is the path I always choose besides rewriting everything to the application entry point. That way if certain routes require special treatment your not left to hack the .htaccess file.
co_ador — 2010-03-13T19:42:23-05:00 — #9
Do you have any reference that shows how to re-write the url within the application?
I was in the mod_rewrite sitepoint tutorial and didn find the second line below
LoadModule rewrite_module modules/mod_rewrite.so
in the httpd.conf file.
what could be done in that place?
paul_wilkins — 2010-03-13T19:51:54-05:00 — #10
You will obtain better answers to this by asking this in the Apache Configuration forum.
oddz — 2010-03-13T20:38:12-05:00 — #11
With path info supported the simplest solution is to explode everything following the entry script by /.
$arrRequestArgs = isset($_SERVER['PATH_INFO'])?explode('/',trim($_SERVER['PATH_INFO'],'/')):array();
So this url: index.php/Product/My-Products-Name/
Would decode to: [0=>Product,1=>My-Products-Name]
co_ador — 2010-03-13T20:39:12-05:00 — #12