Gossamer Forum
Home : Products : Gossamer Links : Discussions :

Server upgrade - Rewrite problems with index pages

Quote Reply
Server upgrade - Rewrite problems with index pages
I use rewrite rules to display all my pages dynamically and don't physically build any Detailed pages ( see this thread from 2010) and Andy did some custom work for me.

My host has just upgraded their server (to cloud) and now my index pages are static unless I add the index file name.

mysite.com/ = static
mysite.com/index.php = dynamic

mysite.com/category1/ = static
mysite.com/category1/index.php = dynamic
mysite.com/category1/page2.php = dynamic

This is the same with any index page in any directory.

Do I need to add something to the htaccess file to get these do display as dynamic or is this something that I need to flag up with my host as it was working fine before the transfer?

Current htaccess file:
Code:
RewriteEngine on

# ANDY NEW!
RewriteCond %{REQUEST_FILENAME} !phpinfo\.php$
RewriteCond %{REQUEST_URI} !xyz
RewriteRule ^(.*)_([0-9]+).php$ /cgi-bin/links/page.cgi?g=Detailed/$2.php;extra=$1;c=$3 [L]

RewriteCond %{REQUEST_FILENAME} !phpinfo\.php$
RewriteCond %{REQUEST_URI} !xyz
RewriteRule ^(.*)_([0-9]+).php$ /cgi-bin/links/page.cgi?g=$1.php;extra=$1;b=1 [L]
# END ANDY CODES

RewriteCond %{REQUEST_FILENAME} !phpinfo\.php$
RewriteCond %{REQUEST_URI} !xyz
RewriteRule ^(.*).php /cgi-bin/links/page.cgi?g=$1.php [L]

RewriteCond %{REQUEST_FILENAME} !phpinfo\.php$
RewriteCond %{REQUEST_URI} !xyz
RewriteRule New/(.*)$ /cgi-bin/links/page.cgi?g=New/$1 [L]

RewriteCond %{REQUEST_FILENAME} !phpinfo\.php$
RewriteCond %{REQUEST_URI} !xyz
RewriteRule Ratings/(.*)$ /cgi-bin/links/page.cgi?g=Ratings/$1 [L]

RewriteCond %{REQUEST_FILENAME} !phpinfo\.php$
RewriteCond %{REQUEST_URI} !xyz
RewriteRule Cool/(.*)$ /cgi-bin/links/page.cgi?g=Cool/$1 [L]

RewriteCond %{HTTP_HOST} ^mysite.com$ [OR]
RewriteCond %{HTTP_HOST} ^mysite.net$ [OR]
RewriteCond %{HTTP_HOST} ^www.mysite.net$ [OR]
RewriteCond %{HTTP_HOST} ^mysite.org$ [OR]
RewriteCond %{HTTP_HOST} ^www.mysite.org$
RewriteRule ^(.*)$ http://www.mysite.com/$1 [R=301,L]

Last edited by:

MJB: Oct 14, 2013, 3:31 PM
Quote Reply
Re: [MJB] Server upgrade - Rewrite problems with index pages In reply to
Mmm, this rule should be picking those up:

Code:
RewriteCond %{HTTP_HOST} ^mysite.com$ [OR]
RewriteCond %{HTTP_HOST} ^mysite.net$ [OR]
RewriteCond %{HTTP_HOST} ^www.mysite.net$ [OR]
RewriteCond %{HTTP_HOST} ^mysite.org$ [OR]
RewriteCond %{HTTP_HOST} ^www.mysite.org$
RewriteRule ^(.*)$ http://www.mysite.com/$1 [R=301,L]

What happens if you remove all the RewriteCond stuff, and then try?

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] Server upgrade - Rewrite problems with index pages In reply to
All or just the ones in your reply?
Quote Reply
Re: [MJB] Server upgrade - Rewrite problems with index pages In reply to
Just that one in my reply.

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] Server upgrade - Rewrite problems with index pages In reply to
No, just the same. Frown
Quote Reply
Re: [MJB] Server upgrade - Rewrite problems with index pages In reply to
Are you 100% sure they are running static? Add some test text into your footer, and see if they show up

Also - if you still can't get it going, shoot over FTP + some example URLs, and I'll take a look when I get a chance

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] Server upgrade - Rewrite problems with index pages In reply to
Someone has just written a review for a DCM-250 which shows on the dynamic page but note the low ShareThis number at the bottom because /index.php was never used.

Now remove index.php from that URL. The review disappears and the ShareThis number is higher as this is a static nightly build of the page that used to display dynamically.

All I'm after is / to display dynamically the same way that /index.php does.

Does that help any? Frown
Quote Reply
Re: [MJB] Server upgrade - Rewrite problems with index pages In reply to
For the homepage, you may need a new rule (just before the last one);

Code:
RewriteRule ^/?$ http://www.mysite.com/$1 [R=301,L]

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] Server upgrade - Rewrite problems with index pages In reply to
Just before the last one?


Just got a reply from my host:
Quote:
There is a redirect in the .htaccess file that works for the following URL:

http://www.mysite.com/index.php

But not the following URL:

http://www.mysite.com/

This doesn't access the following script:

/home/mysite/public_html/cgi-bin/links/page.cgi

Unfortunately this is a scripting issue. Please contact the script developers for the account to resolve this issue.
Quote Reply
Re: [MJB] Server upgrade - Rewrite problems with index pages In reply to
Hi,

Yeah, like so:

Code:
RewriteEngine on

# ANDY NEW!
RewriteCond %{REQUEST_FILENAME} !phpinfo\.php$
RewriteCond %{REQUEST_URI} !xyz
RewriteRule ^(.*)_([0-9]+).php$ /cgi-bin/links/page.cgi?g=Detailed/$2.php;extra=$1;c=$3 [L]

RewriteCond %{REQUEST_FILENAME} !phpinfo\.php$
RewriteCond %{REQUEST_URI} !xyz
RewriteRule ^(.*)_([0-9]+).php$ /cgi-bin/links/page.cgi?g=$1.php;extra=$1;b=1 [L]
# END ANDY CODES

RewriteCond %{REQUEST_FILENAME} !phpinfo\.php$
RewriteCond %{REQUEST_URI} !xyz
RewriteRule ^(.*).php /cgi-bin/links/page.cgi?g=$1.php [L]

RewriteCond %{REQUEST_FILENAME} !phpinfo\.php$
RewriteCond %{REQUEST_URI} !xyz
RewriteRule New/(.*)$ /cgi-bin/links/page.cgi?g=New/$1 [L]

RewriteCond %{REQUEST_FILENAME} !phpinfo\.php$
RewriteCond %{REQUEST_URI} !xyz
RewriteRule Ratings/(.*)$ /cgi-bin/links/page.cgi?g=Ratings/$1 [L]

RewriteCond %{REQUEST_FILENAME} !phpinfo\.php$
RewriteCond %{REQUEST_URI} !xyz
RewriteRule Cool/(.*)$ /cgi-bin/links/page.cgi?g=Cool/$1 [L]

RewriteRule ^/?$ http://www.mysite.com/$1 [R=301,L]

RewriteCond %{HTTP_HOST} ^mysite.com$ [OR]
RewriteCond %{HTTP_HOST} ^mysite.net$ [OR]
RewriteCond %{HTTP_HOST} ^www.mysite.net$ [OR]
RewriteCond %{HTTP_HOST} ^mysite.org$ [OR]
RewriteCond %{HTTP_HOST} ^www.mysite.org$
RewriteRule ^(.*)$ http://www.mysite.com/$1 [R=301,L]

Not sure what your host is on about (unless they are getting at the same thing as me, with the rule above in red)

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] Server upgrade - Rewrite problems with index pages In reply to
No, that didn't work.

I'm really angry with my hosts, and I've just let them know about it. How can it work perfectly fine for years and then when they change their servers it becomes my problem? It's not me that's altered anything. I don't really know how this stuff works but I try damn hard to understand it and when I (with help from others of course) do manage to get it to work I leave it well alone. Might be time to jump ship and flush my 10+ years allegiance with my host down the pan.

Rant over. Unsure
Quote Reply
Re: [MJB] Server upgrade - Rewrite problems with index pages In reply to
Sounds like the DirectoryIndex value changed. What page is showing up when you say 'static'?

Adrian
Quote Reply
Re: [brewt] Server upgrade - Rewrite problems with index pages In reply to
Static = the the actual index.php file on the server but without it displayed in the address bar ( foo.com/ )

Dynamic = /cgi-bin/links/page.cgi?d=1 (but Andy's rewrite rules make my dynamic pages look like they are static with a "page.php" in the address bar rather than page.cgi?)

Previously the index page for foo.com/ would act dynamically in the same way as foo.com/index.php would.
Quote Reply
Re: [MJB] Server upgrade - Rewrite problems with index pages In reply to
I think Adrian was more suggesting what you have set for "DirectoryIndex"

You can try adding this into your .htaccess near the top:

Code:
DirectoryIndex index.php index.html

...and see if that helps

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] Server upgrade - Rewrite problems with index pages In reply to
No change.

Just to prove it I renamed index.php.BAK on the server. foo.com/ displayed the directory list. foo.com/index.php displayed the home page.
Quote Reply
Re: [MJB] Server upgrade - Rewrite problems with index pages In reply to
Shoot over FTP logins, and I'll have a look when I get a chance.

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] Server upgrade - Rewrite problems with index pages In reply to
My host has changed from Apache to Lightspeed. Would this have any relevance?

Also, and I don't know if this is connected or related in any way, I had a php include using check_if_is_script global and that no longer works either.

Andy, I don't want to take up any of your time but appreciate your offer. If you can take a quick look at it then that's great but if it needs more than that then I think I'll just call it a day.
Quote Reply
Re: [MJB] Server upgrade - Rewrite problems with index pages In reply to
Hi,

Its possible that Lightspeed is causing it. A quick google came up with a few similar issues, but no real solution that I could find. Does seem a bit weird though!

Quote:
Also, and I don't know if this is connected or related in any way, I had a php include using check_if_is_script global and that no longer works either.

Nah, that shouldn't make a difference (mod_rewrite is separate from that)

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] Server upgrade - Rewrite problems with index pages In reply to
Update:

Huge thank you to Andy for sorting this out for me and my "really weird" set-up.

Now off to try and sort this LiteSpeed php include problem out. Will start another thread if I get stuck. Blush

Last edited by:

MJB: Oct 17, 2013, 9:30 AM