homepage Welcome to WebmasterWorld Guest from 54.237.38.30
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Home / Forums Index / Code, Content, and Presentation / Apache Web Server
Forum Library, Charter, Moderators: Ocean10000 & incrediBILL & phranque

Apache Web Server Forum

    
Non-Dev Website Owner could use a hand
.htaccess has been changed and site is not working as expected
allteamz



 
Msg#: 4584416 posted 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

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



 
Msg#: 4584416 posted 9:24 am on Jun 15, 2013 (gmt 0)

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



 
Msg#: 4584416 posted 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.

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / Apache Web Server
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved