Forum Moderators: phranque
Q2) I would like to change all the links in my files from .html to .php
BUT I only want to change the internal links for my website - I do not want to change the outbound
external links. So, I want to change:
www.mydomain.com/variable_here.html
to www.mydomain.com/variable_here.php
BUT NOT change in any way:
www.externaldomain.com/variable_here.html
I guess to do this I need some regular expression that can make the distinction between:
mydomain.com/variable_here.html
and externaldomain.com/variable_here.html
But what form would such a regular expression take in dreamweaver? HOw can I account that
"variable_here" can vary in length and characters? I have looked in the Dreamweaver documentation but am a bit stumped.
At the top:
<?php ob_start();?>
At the bottom:
<?php
$page=ob_get_clean();
//All lines with NO domain name
$page=preg_replace("/(href\=\"[^\: ]*?).html/ism","$1.php",$page);
//All lines with YOUR domain name
$yourdomain="http://www.widgets.foo";
$page=preg_replace("/(".preg_quote($yourdomain)."[^ ]*?).html/ism","$1.php",$page);
header("Content-length: ".strlen($page));
print $page;
?>
[webmasterworld.com...]
I think Grep is unix only. IS there any windows tools i can use?
I dont understand the second post. What is that php code for? Sorry m8 for my lack of insight.
However, I still don't understand why you don't enable php parsing for the html extension, as jatar_k suggested. Changing all your urls is like going back to square one with all the search engines.
I think I may need to "change" my html pages to php due to the shopping cart I am using. My html pages are informational pages that I had already created prior to using the cart (osc) and I've been reading that mixing the cart's php pages with the site's hmtl pages will cause sessions problems for the customer.
It has always been my limited understanding that once you place one little snippet of php code in a html page, you have to rename the page ext from .html to .php.
Does this php parsing eliminate that need? How does it work and what does it involve to implement it?
Thanks in advance
But I am still unable to do the second part:
--------
I would like to change all the links in my files from .html to .php
BUT I only want to change the internal links for my website - I do not want to change the outbound
external links. So, I want to change:
www.mydomain.com/variable_here.html
to www.mydomain.com/variable_here.php
BUT NOT change in any way:
www.externaldomain.com/variable_here.html
I guess to do this I need some regular expression that can make the distinction between:
mydomain.com/variable_here.html
and externaldomain.com/variable_here.html
But what form would such a regular expression take in dreamweaver? HOw can I account that
"variable_here" can vary in length and characters? I have looked in the Dreamweaver documentation but am a bit stumped.
----------
Can anyone help?