Hi, thank you for your comment GMD, actually I did hear about mod_rewrite, but I was thinking about having the articles title at the search engine friendly url's, that makes it a little more complicated, at least for me, since I'm not a programmer, but I think I will give up about that idea, a whole day trying to figure it out and nothing.
Ok, now, although I think I'm not going to have the articles titles at the url's because of my ignorance about how to do it, actually I have advanced a little with this, I created search engine friendly urls for the individual articles viewing pages with mod_rewrite, not as I wanted them to be, but at least they are search engine friendly, the code is as follows:
at .htaccess file at web directory:
Add:
Code:
# Enable mod_rewrite, start rewrite engine
Options +FollowSymLinks
RewriteEngine on
#
# Internally rewrite search engine friendly static URL to dynamic filepath and query
RewriteRule ^article-([^-]+)-([^.]+)\.html$ /articles.php?articleID=$1&action=$2 [L]
#
# Externally redirect client requests for old dynamic urls to equivalent new static urls
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /articles\.php\?articleID=([^&]+)&action=([^\ ]+)\ HTTP/
RewriteRule ^articles\.php$ /article-%1-%2.html? [R=301,L]
Ok, this makes url's like:
http://sitename.ext/articles.php?articleID=25&action=viewarticle
... to look like this:
http://sitename.ext/article-25-viewarticle.html
Now, here is the question:
Now that I have made the search engine friendly url's, is there a way to change all articles links created by the script to this new format without having to manually edit every one of their instances a my text/script editor? How? I read something about preg_replace() but I didn't find the way to apply it (str_replace() might be helpful too, I don't really know)
Maybe there are not many instances for articles links, but since I plan to do this search engine friendly url's conversion at the profiles pages also (and some other sections of the site), knowing how to do this might be critical for not spending too much time changing all the respective links structures manually.
I will appreciate a lot if someone can help me with this, maybe the function getArticlesList( $iCategoryID ) code located at inc/articles.inc.php can be helpful for explaining how changes should be applied to accomplish what I need... or maybe not, I don't know, I really need help here.
Help Please!
Bookmarks