Debt Help - Remortgages - Online Loans - Mortgages - Mortgages

PDA

View Full Version : Converting HTML pages for PHP script without altering URL


amanamission
Oct 29th 2007, 7:37 am
I am planning to install Aardvark PHP on many of my pages which are currently static. The problem is that new pages created by the script are not customizable. Instead, the script produces

http://www.domain.com/index.php?a=page&id=pagetitle

where I need to have:

http://www.domain.com/pagetitle.htm

in order to utilize my established pages.

I have been wrestling in vain with this, trying variou mod_rewrite formulas, but nothing seems to work. I would think this is a simple matter, but now I wonder if the script is overwriting my URL's because it is harmful to the script to change them.
The more I learn, the more confused I become. Static pages are concrete, I can go to them and make my changes-but a dynamic page doesn't even exist, in the sense of a physical file on my server.

Is it dangerous to some scripts to rewrite the URL? What is the best method for navigating this? I have looked at PHP rewrites, but the ones i see are all too complex and not applicable.
This is a very simple rewrite...I only want to change the URL's as above without disturbing any other pages or the SE positioning of the pages I plan to convert. So I'm wondering if I'm missing something.

schoash
Oct 29th 2007, 8:23 am
You can try to extract the
URL with an extra script and set the various $_GET and $_POST according to what you need b4 you run the actual script..

amanamission
Oct 29th 2007, 8:36 am
Wouldn't that break the script? I assume they made it that way for a reason.

I think I have source code on it, script is open source, want to take a crack at forking it?

schoash
Oct 29th 2007, 8:41 am
well at the moment i am at work.. i can have a look later

dadougalee
Oct 29th 2007, 3:09 pm
just do a mod_rewrite

In your root add a .htaccess file. In the file add this code:
RewriteEngine On
RewriteRule ^/(.*).htm$ /index.php?a=page&id=$1

I'm pretty sure it is something like that though. You are prolly going to need to see if your server supports mod_rewrites

amanamission
Oct 29th 2007, 8:27 pm
Yeah, I've been trying that. The problem is that I need to convert pages in several styles: I have pages which are .htm, others .html, and other that are folders. And I have other pages that will be wordpress or static on the same domain that I do not want to rewrite.
Best solution would be a mod or plugin for custom permalinks, like Wordpress. This is a pretty widely used script, I think it would be fairly popular if someone wants to give it a shot.
@schoash: If you do this, I will get you some high quality links and promote your mod at the support forum if you like. Please PM me and we'll discuss this. Sending PM.

dadougalee
Oct 30th 2007, 3:37 am
Sorry, but I am unfamiliar with wordpress.

gordi555
Oct 30th 2007, 5:22 am
This is what I do...

1. First I modify the .htaccess to lookup a file if a url is not found...


Options -Indexes
DirectoryIndex index.php index.html index.htm
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ read.php [L,QSA]


This says "if i can't find it, let read.php try and sort it out".

2. read.php


$TheURL = $_SERVER['REQUEST_URI'];
$var_array = explode("/",$TheURL);
$GotURL = $var_array[1]; //domain.com/url/
//print $GotURL;
$articlesql = mysql_query("SELECT *, date_format(DateTime,'%W, %D %M %Y') as DateTime1 FROM project_blog_entry WHERE URL = '" . mysql_real_escape_string($GotURL) . "'");



So you can see that if you store the urls in the db then you can look them up.

May help may not but hope it does.

M@fia
Jan 21st 2008, 9:07 am
hi
i dont work with database
i need something like this
domain.com/index.php?q=digitalpoint
=
domain.com/digitalpoint.html
tnx