Rewriting requests to Bludit subdirectory

jonathanholvey
Ssr. Bludit
Posts: 23
Joined: Mon May 22, 2017 10:15 pm

Hi,

I want Bludit installed inside directory on my server, so I can manage it as a separate Git repository to the rest of my project. I also want to exclude that directory from my site's URLs.

I'm trying to use Apache's mod_rewrite to silently forward requests to Bludit, but the following .htaccess snippet in my server root forwards everything to the home page:

Code: Select all

RewriteEngine On
RewriteRule ^(.*) /bludit/$1 [L,NC,QSA]
For example, http://example.com/admin shows the home page, but http://example.com/bludit/admin shows the admin dashboard. Should it be possible to get the first URL working correctly?

Cheers,
Jon
User avatar
diego
Site Admin
Posts: 773
Joined: Sat May 16, 2015 2:53 pm
Been thanked: 1 time
Contact:

jonathanholvey
Ssr. Bludit
Posts: 23
Joined: Mon May 22, 2017 10:15 pm

Similar, except that I don't want /bludit to appear in my URLs. The lack of the [R] flag allows this, but Bludit doesn't seem to pick up the requests properly.

I can view bludit/install.php by visiting http://example.com/install.php. It just seems that bludit/index.php isn't picking up the rewritten URLs.
User avatar
diego
Site Admin
Posts: 773
Joined: Sat May 16, 2015 2:53 pm
Been thanked: 1 time
Contact:

Yes sure, you need to change the Root Directory. http://httpd.apache.org/docs/2.0/mod/co ... cumentroot

www.domain.com -> /bludit/

and NOT
www.domain.com/bludit/ -> /bludit/

or I miss understanding?
jonathanholvey
Ssr. Bludit
Posts: 23
Joined: Mon May 22, 2017 10:15 pm

That's not really what I'm after either. I want to be able to have parts of my site outside the /bludit directory, but use bludit for handling most pages.

Is there any reason why what I'm trying won't work with Bludit? Does it compare the URL path to the file system path when handling requests?
User avatar
Edi
Site Admin
Posts: 3121
Joined: Sun Aug 09, 2015 5:01 pm
Location: Zurich
Has thanked: 54 times
Been thanked: 77 times
Contact:

jonathanholvey wrote: Tue Aug 22, 2017 1:40 pm That's not really what I'm after either. I want to be able to have parts of my site outside the /bludit directory, but use bludit for handling most pages.
If Bludit is installed in the subdirectory /bludit it can be accessed with http://mydomain.com/bludit.

If you rewrite with .htaccess /bludit ("map" the installation as it would be installed in the root directory), all requests will be rewritten with this rule. Not only the ones of Bludit.

Therefore you have to give an own rule for every case.

This has nothing to do with Bludit. ;-)
Clickwork - Websites mit Bludit | Planet Bludit - Tipps und Snippets
jonathanholvey
Ssr. Bludit
Posts: 23
Joined: Mon May 22, 2017 10:15 pm

Edi wrote: Tue Aug 22, 2017 5:10 pm If you rewrite with .htaccess /bludit all requests will be rewritten with this rule. Not only the ones of Bludit.

Therefore you have to give an own rule for every case.
I realise that, however even if I want all requests to go to the bludit directory, Bludit doesn't recognise the URLs. Even rewriting directly to Bludit's index.php (as per Bludit's own .htaccess) doesn't work:

Code: Select all

RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*) bludit/index.php [PT,L]
Any thoughts?
User avatar
Edi
Site Admin
Posts: 3121
Joined: Sun Aug 09, 2015 5:01 pm
Location: Zurich
Has thanked: 54 times
Been thanked: 77 times
Contact:

The following redirect to /bludit works:

1) .htaccess in the root directory:

Code: Select all

RewriteEngine On
RewriteRule ^$ /bludit [L]
2) .htaccess of the Bludit distribution in the directory, where Bludit is installed.

Otherwise you have to configure the server, and set /bludit as root directory. This is the easiest way. ;-)

Bludit uses the path of the directory of the installation. If Bludit is installed in the directory /bludit all internal links use /bludit.
Clickwork - Websites mit Bludit | Planet Bludit - Tipps und Snippets
jonathanholvey
Ssr. Bludit
Posts: 23
Joined: Mon May 22, 2017 10:15 pm

Edi wrote: Wed Aug 23, 2017 9:11 pm Bludit uses the path of the directory of the installation. If Bludit is installed in the directory /bludit all internal links use /bludit.
Unfortunately this redirects to the /bludit folder, rather than rewriting the URL. Unless you and diego have misunderstood what I'm trying to achieve, I can only assume this is a limitation of Bludit, and is not possible.

Thanks for your help anyway.

Is there any chance this kind of setup could be supported in Bludit 2? Point me in the right direction and I'd be happy to contribute to the project to help get it working.

Cheers,
Jon
User avatar
Edi
Site Admin
Posts: 3121
Joined: Sun Aug 09, 2015 5:01 pm
Location: Zurich
Has thanked: 54 times
Been thanked: 77 times
Contact:

It has to do with the configuration of your server. Why is this a limitation of Bludit in your opinion?

As I understand it you try to install Bludit in a subdirectory /bludit. But you try to use as URL the domain name without the subdirectory. Why do you not set /bludit as root directory of the domain?

P. S. I'm neither a server professional nor an expert for .htaccess. ;-)
Clickwork - Websites mit Bludit | Planet Bludit - Tipps und Snippets
Post Reply