 |

04-12-2006, 04:50 PM
|
 |
SEO Junior and a half
|
|
Join Date: Feb 2006
Posts: 56
|
|
|
Simple rewrite rules from php to html pages
Hi
I need someone help me with this:
I have several pages ending .php
I need to rewrite them to end in .html
I also need to change the name of the url: example:
curently i have: www.domain.com/2345.php
2345.php has a <title> and i want it looks like:
www.domain.com/title.html
I know i have to put some code in .htacess file, but i tried to read, read, read and canīt get nothing
Thank you for your reading this.
|

04-14-2006, 01:40 AM
|
 |
SEO Junior and a half
|
|
Join Date: Feb 2006
Posts: 56
|
|
hmm
nobody?
nothing?

|

04-14-2006, 02:23 AM
|
 |
SEO GUY Moderator
|
|
Join Date: Sep 2004
Location: Antalya, Turkey
Posts: 4,118

|
|
|
Hi,
Can I ask first, so you have any php coding in the existing files or are they just straight html?
If they are straight html, you can use something like this in your htaccess:
Options +Indexes
Options +FollowSymlinks
RewriteEngine on
RewriteBase /
RewriteRule ^(.*)\.html$ $1.php [L]
Don't forget though, rewriting your urls is a major step that shouldn't be taken lightly. Static files with php extensions will rank just as well as html documents, in my experience.
Cheers,
Paz.
__________________
10.3 million entries for Hotels in Turkey but I'm still chipping away.
|

04-14-2006, 03:07 AM
|
 |
SEO Junior and a half
|
|
Join Date: Feb 2006
Posts: 56
|
|
|
hmmm
You are right.
I expressed bad and i think i canīt have them like html.
I need to get the urls insted of
domain.com/12345.php
to
domain.com/title-of-the-123456.php
??
Thank you.
|

04-14-2006, 10:45 AM
|
 |
SEO GUY Moderator
|
|
Join Date: Sep 2004
Location: Antalya, Turkey
Posts: 4,118

|
|
|
Haha, well maybe I wasn't thinking straight either, but as I understand it you can also use htaccess to parse html files as though they were php files. I'm not sure if you can combine url rewriting and parsing at the same time though.
Also I'm not sure if what you want to do is worth the trouble. It's nice to have keywords in the url, but the disruption it will cause to your site may make it unproductive.
Anyway here we go:
RewriteEngine On
RewriteCond %{HTTP_HOST} ^www.domain.com$
RewriteCond %{REQUEST_URI} !^/some-title.*
RewriteRule ^(.*)$ /some-title$1
Cheers,
Paz.
__________________
10.3 million entries for Hotels in Turkey but I'm still chipping away.
|

04-18-2006, 12:31 PM
|
 |
SEO Junior and a half
|
|
Join Date: Feb 2006
Posts: 56
|
|
|
Thank you Paz. It worked ok.
This is the subject about seo/servers/languages i dontīreally understand almost nothing, you gave me a big help, thank you very much.
|

04-20-2006, 07:28 AM
|
|
SEO
|
|
Join Date: Dec 2004
Posts: 220
|
|
|
|

04-20-2006, 08:39 AM
|
 |
SEO GUY Moderator
|
|
Join Date: Sep 2004
Location: Antalya, Turkey
Posts: 4,118

|
|
|
Hi Guybrush,
Are you sure you really want to do this? Yahoo and Google are getting quite good at indexing dynamic urls, especially if you only have one variable.
If the pages are indexed already I wouldn't bother.
But if you must, you can try this:
Options +Indexes
Options +FollowSymlinks
RewriteEngine on
RewriteBase /
RewriteRule ^news/(.*)\.html$ article.php?title=$1 [L]
I've added an .html for you, but you can change it to .htm as nec
If you don't want either then you should be able to delete the \.html bit; but I've never tested that. Let me know how you get on.
Cheers,
Paz.
__________________
10.3 million entries for Hotels in Turkey but I'm still chipping away.
|

04-20-2006, 11:21 AM
|
|
SEO
|
|
Join Date: Dec 2004
Posts: 220
|
|
Advice accepted and the rewrite idea dropped.
By the way, the site aint in operation yet so no harm wouldve been done. Actually its a news site and felt that the "article.php" in the url could be misleading.
many many thanks.
|

04-20-2006, 02:10 PM
|
 |
SEO GUY Moderator
|
|
Join Date: Sep 2004
Location: Antalya, Turkey
Posts: 4,118

|
|
Quote:
|
Originally Posted by guybrush
Advice accepted and the rewrite idea dropped.
By the way, the site aint in operation yet so no harm wouldve been done. Actually its a news site and felt that the "article.php" in the url could be misleading.
many many thanks.
|
haha well sorry for any confusion, but if it's a new site then I'd go for it! It's a simple enough mod, and I always thing static htmls look more attractive in the serps listings.
Cheers,
Paz.
__________________
10.3 million entries for Hotels in Turkey but I'm still chipping away.
|
 |
| Thread Tools |
|
|
| Display Modes |
Rate This Thread |
Linear Mode
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
|
|