Topic Closed
Charles S
448 Posts
13.7K Downloads
2 Themes
8 Plugins

I've spent a bit of the day playing with gpEasy installed on my server at the domain level. I wanted to figure out if I could get the mod rewrite to remove the www, index.php, and redirect the "home" (top level page in gpEasy) to the domain (domain.com/).

The htaccess that I used --of course "example" was replaced with the actual domain name:

 

<IfModule mod_rewrite.c>
RewriteEngine On
 
# remove www from URL
RewriteCond %{HTTP_HOST} ^example.com$
RewriteRule ^Home$ "http\:\/\/example\.com\/" [R=301,L]
 
# redirect "home" to domain - this was generated in cPanel as a redirect and had to be moved above the gpeasy rewrite to remove index.php in order to work
 
RewriteCond %{HTTP_HOST} ^www.example.com$ [NC]
RewriteRule ^(.*)$ http://example.com/$1 [R=301,L]
 
# This is gpEasy's htaccess rules for removing index.php
# Don't Rewrite For These filetypes
# you may want to add other extensions like mp3|mpeg|wav|pdf|xml|txt
RewriteCond %{REQUEST_URI} !\.(bmp|css|gif|ico|jpg|jpeg|js|png|shtml|zip)$ [NC]
 
# Don't Rewrite For Existing Files
RewriteCond %{REQUEST_FILENAME} !-f [NC]
 
# Don't Rewrite For Existing Directories Except for the root directory
RewriteCond %{REQUEST_FILENAME} !-d [NC,OR]
RewriteCond %{REQUEST_URI} ^/$
 
RewriteRule (.*) /index.php [L]
 
</IfModule>
 
----------------------------------end htaccess rules ------------------------------------------------------
 
all the rules worked fine as far as browsing the site. WWW are removed, index.php is removed, and the "Home" page is redirected to the domain.com/ page. However, there are a couple minor issues.
 
Problems:
  1. As noted in other posts here inserting an image from CKEditor doesn't work when mod rewrite is on.
  2. Problems arise in editing the "home" pages due to the redirect for the home page.
    1. once an image is inserted into the home page and saved, when editing the image again via the image icon on CKEditor the url is lost in the editor--this doesn't happen on other pages. Clearly due to the redirect.
    2. the "preview" doesn't work when editing the "home" page, thus all work will be lost if you use it. The "save" does work.
When removing the rewrite rules images don't break as they do on my localhost install.Most everything else seems to work fine other than the above. 
 
Are there any things that can be changed in the htaccess to solve these problems?
Or is it a CKEditor/gpEasy issue?
 
Also, it would be great is someone else could verify these findings.
thanks
Edited: 10 years ago#471

did anyone get anywhere with this? I think it would be much nicer if the 'index.php/' wasn't in the url...

10 years ago#515

Charles S
448 Posts
13.7K Downloads
2 Themes
8 Plugins

Removing the index.php is fine, but you will have a problem when browsing for an image in ckeditor, but the htaccess works fine to remove index.php

10 years ago#517

Solution?  I have an idea for what might be a solution for browsing for images.

If you comment out the lines

//define('gp_indexphp_root','/'); //define('gp_indexphp',false);

then it works. It seem that it doesn't really matter about the .htaccess.

Would it be possible, when an admin user logs in, or when you click to edit a page, for to override these settings and turn it off (showing the index.php/). And for general users viewing the site not logged in, those lines of code would be turned on, hidding index.php from the url...

10 years ago#525

Edited: 10 years ago#526

Charles S
448 Posts
13.7K Downloads
2 Themes
8 Plugins

if you comment out those two lines the the mod rewrite does not work for gpEasy. You may have the htaccess file loaded but it won't take out index.php unless you enable those two lines. I think you realize that part. . . as far as that being a fix. What if you do that right when the search engines crawl your site? Or a visitor is there--many links will no doubt be broken. 

I'm sure there is a solution for this problem. Check out the CKEditor Demo. Insert an image and you can see that they are not having a problem and they don't have index.php in the URL, thus I don't think it's a CKEditor problem. 

Reading through the docs and discussions I think that removing index.php is rather new in gpEasy so it may be a simple bug that was overlooked and hopefully will be fixed soon.

Nonetheless you can certainly use something like Filezilla to comment out those two lines while you work on a page then reactivate them. 

Edited: 10 years ago#531

I didn't mean change the whole site settings when you want to edit, I meant that maybe there is a way to just temporarily override these settings to disable it when someone logs in as an admin - and only on their computer.

10 years ago#564

Charles S
448 Posts
13.7K Downloads
2 Themes
8 Plugins

I don't think that is possible on the server side. I think it would be much easier to just fix the bug.

10 years ago#568

Topic Closed

 

News

elFinder 2.1.50 in Upcoming Release
12/28/2019

A new release for Typesetter is in the works with a lot of improvements including the ... Read More

Typesetter 5.1
8/12/2017

Typesetter 5.1 is now available for download. 5.1 includes bug fixes, UI/UX improvements, ... Read More

More News

creisi productions

Dienstleistungen von creisi productions, Luzern (Schweiz): * Konzeption, Planung und Erstellung Ihres Internet-Auftritts * Betreuung und Aktualisierung/Pflege Ihrer Website * ...

Find out more about our Provider Spotlight

Log In

  Register