Welcome to WebmasterWorld Guest from 54.221.28.179

Forum Moderators: Ocean10000 & incrediBILL & phranque

Message Too Old, No Replies

Non-Dev Website Owner could use a hand

.htaccess has been changed and site is not working as expected

     

allteamz

6:19 am on Jun 15, 2013 (gmt 0)



Hello,

I have worked with two different developers on my site and now I am noticing that something has changed and I cannot figure out what changes to make to my .htaccess operate correctly.

Here is the contents of my .htaccess file

RewriteEngine on
RewriteBase /
RewriteCond %{HTTP_HOST} !^www\.example\.com
RewriteRule ^(.*)$ http://www.example.com/$1 [R=permanent,L]
RewriteRule ^(sitemaps|images|upload|css|js|_tmp|facebox|cron|captcha|phpMyAdmin|ajax_upload|server-status) - [L]
RewriteRule ^(BingSiteAuth.xml|robots.txt|favicon.ico|sitemap.php|sitemap.xml|logout.php|login.php) - [L]
RewriteRule ^.*$ index.php


Here are the two problems I am having and man would I appreciate a little help.

1. Non-existent pages or URLs return a blank page with SiteName text on the screen. No idea why but below is what curl returns. The page does not exist and I would prefer that it redirect to e404.php

curl -I http://www.example.com/buster_open
HTTP/1.1 200 OK
Date: Sat, 15 Jun 2013 06:00:25 GMT
Server: Apache/2.2.22 (Ubuntu)
X-Powered-By: PHP/5.3.10-1ubuntu3.6
Set-Cookie: PHPSESSID=111bj3vei3q6fcu3jadj2slb20; path=/
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache
Vary: Accept-Encoding
Content-Type: text/html; charset=UTF-8


2. The second issue is related to Campaign analytics from MailChimp which creates a URL something like this...
http://www.example.com/profile_builder?utm_source=Coach+Email+List&utm_campaign=4617df9768-Baby_come_back_to_Coaches6_14_2013&utm_medium=email&utm_term=0_a50708424b-4617df9768-[LIST_EMAIL_ID]


which I thought would automagically redirect to
http://www.example.com/profile_builder


This might not be related, but how would I change the .htaccess file to push this link to the latter?

Thanks for giving me a look and any help you may offer.

[edited by: phranque at 12:08 pm (utc) on Jun 15, 2013]
[edit reason] Please Use Example.com [webmasterworld.com] [/edit]

lucy24

9:24 am on Jun 15, 2013 (gmt 0)

WebmasterWorld Senior Member lucy24 is a WebmasterWorld Top Contributor of All Time Top Contributors Of The Month



Non-existent pages or URLs return a blank page with AllTeamz text on the screen. No idea why but below is what curl returns. The page does not exist and I would prefer that it redirect to e404.php

No, you wouldn't. Really. You would prefer that it return a 404 response accompanied by showing the content of e404.php (which, incidentally, really ought to be a static html page for safety's sake).

But this is not an htaccess issue; it's a php issue. So make your developer fix it. The server has done its job by handing off all requests to index.php. As far as it's concerned, all requests are 200. It's up to the php to do its own research, send out the correct responses and display the appropriate page-- which might be the error page.

The second issue is related to Campaign analytics from MailChimp which creates a URL something like this...
http://www.example.com/profile_builder?utm_source=Coach+Email+List&utm_campaign=4617df9768-Baby_come_back_to_Coaches6_14_2013&utm_medium=email&utm_term=0_a50708424b-4617df9768-[LIST_EMAIL_ID]

which I thought would automagically redirect to http://www.example.com/profile_builder

Uhm. It can't redirect to that, because it's already there. Did you mean that the whole enormous long horrible query string should simply be thrown away? Then where does its information go?

RewriteRule ^(sitemaps|images|upload|css|js|_tmp|facebox|cron|captcha|phpMyAdmin|ajax_upload|server-status) - [L]
RewriteRule ^(BingSiteAuth.xml|robots.txt|favicon.ico|sitemap.php|sitemap.xml|logout.php|login.php) - [L]
RewriteRule ^.*$ index.php

Hm, nice variation on the usual !-d and !-f. All requests for pages should be sent to index.php while other requests-- and some selected pages-- pass on through. But what is index.php supposed to do about all those requests? I don't see any query string in there, so how does the page know what to do?

In any case I think it would be less chaotic if you sorted by extension:

RewriteRule \.(css|jpg|txt|gif) - [L]
listing all non-page extensions you actually use. Even list html if you've got static pages that aren't involved in the php business. And then the second batch goes

RewriteRule ^(sitemap|log(out|in))\.php - [L]
et cetera, listing any php pages that exist in their own right.

allteamz

5:50 pm on Jun 15, 2013 (gmt 0)



Thanks Lucy for your reply.
The first part makes perfect sense and I will approach it from that angle.

The second issue, the intent was to capture the information in Google Analytics for tracking purposes but still end up and the same page.

I will have to research the last part as well but I appreciate your help tremendously.
 

Featured Threads

Hot Threads This Week

Hot Threads This Month