Jump to content

domain and www.domain issues


paulgodard

Recommended Posts

I am very new to Mod_Rewrite.  However with the help of some people I managed to have my dynamic url converted to static one. But there is a hic (see the htaccess file below).

 

Why does the second url not go to the correct page?  How can I modify the rewriterule to do so without affecting the dynamic ->static conversion?

 

Can the actual htaccess file have negative impact on SEO?

 

 

http://www.paulgodard.com/Content_1010000000_artist.htm goes to the artist page OK

 

http://paulgodard.com/Content_1010000000_artist.htm goes to the home page NOT OK

 

 

htaccess file :

----------------

#Removes session id from URL - site will not work if cookies are not enabled

php_flag session.use_trans_sid off

 

#Redirects site from http://domain to http://www.domain (301 redirect)

RewriteEngine on

RewriteCond %{HTTP_HOST} ^paulgodard.com [NC]

RewriteRule ^(.*)$ http://www.paulgodard.com/ [R=301,L]

 

#Redirects static url (se friendly) to dynamic url (real filename)

RewriteRule ^Content_(.+)_(.+).htm$ /Alpha/Page.php?Content_ID=$1&kw=$2 [nc]

RewriteRule ^News_(.+)_(.+)_(.+).htm$ /Alpha/Page.php?Content_ID=$1&News_ID=$2&kw=$3 [nc]

 

#Redirects error to page

ErrorDocument 401 /AccessControl/AdminMessage.php?Error=401

ErrorDocument 404 /AccessControl/AdminMessage.php?Error=404

ErrorDocument 500 /AccessControl/AdminMessage.php?Error=500

 

Link to comment
Share on other sites

This is amazing... I found the solution...

 

There must be a $ after the first domain as well as /$1 to carry the querystring along in the rewrite rule, and the flag 'L' must be removed.  This makes sense!

 

#Redirects site from http://domain to http://www.domain (301 redirect)

#Anything that follows the domain will be passed!

RewriteEngine on

RewriteCond %{HTTP_HOST} ^kidsofnature.com$ [NC]

RewriteRule ^(.*)$ http://www.kidsofnature.com/$1 [R=301]

 

#Redirects static url (se friendly) to dynamic url (real filename)

RewriteRule ^Content_(.+)_(.+).htm$ /Alpha/Page.php?Content_ID=$1&kw=$2 [NC]

RewriteRule ^News_(.+)_(.+)_(.+).htm$ /Alpha/Page.php?Content_ID=$1&News_ID=$2&kw=$3 [NC]

 

BUT I have another question...

 

My index.php file at the root level redirects to /Alpha/Page.php for many (good) reasons :

 

// get optional query string

$QueryString0 = $_SERVER['QUERY_STRING'];

// load Page with query string

$Link = "Alpha/Page.php";

if ($QueryString0) { $Link .= "?".$QueryString0; }

header("location:".$Link);

 

This means that I never see "www.kidsofnature.com" alone as the url but always with the "/Alpha/Page.php" appended.

 

How can I avoid the url to change while I am redirecting the page?  Via php or mod_rewrite?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.