Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2024-03-07 13:58:29

lindabb
Member
Registered: 2023-02-17
Posts: 111

change admin_url

Hello,
How do I change the admin_url?
Currently, I have to type a http://localhost/textpattern to the go to admin login page.
I would like to change it to the http://localhost/backend or something like this.

Thank you

Offline

#2 2024-03-07 20:23:45

jakob
Admin
From: Germany
Registered: 2005-01-20
Posts: 4,596
Website

Re: change admin_url

I think people have done this in the past using the .htaccess file (if your server is running Apache) but the /textpattern/ directory is still there. The multi-site installation setup can also be used to make the admin area usable from a separate subdomain to the public site.


TXP Builders – finely-crafted code, design and txp

Offline

#3 2024-03-08 17:08:47

lindabb
Member
Registered: 2023-02-17
Posts: 111

Re: change admin_url

Thank you,
I tried this, but it looks like a loop issue. 

RewriteRule ^textpattern/?$ http://localhost/ [R,L]
RewriteRule ^backend/?$ http://localhost/textpattern [R,L]

There has to be a better way to change that URL. I wish to see hard-codded stuff go away.

Thank you

Offline

#4 2024-03-08 18:04:33

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,271
Website GitHub

Re: change admin_url

The main issue is that the config.php file resides inside the /textpattern directory. Without that, we can’t connect to the database so can’t store the admin folder name somewhere in the DB without first accessing the file… inside the admin folder.

Textpattern has always adopted convention over configuration, where it makes sense. It keeps things simple and fast. We could do things better. Organize things differently, but that comes at the expense of backwards compatibility, which we strive to maintain as best we can. We could move the config file further up the tree, but we keep it tucked away so it is more secure and can be locked with tighter permissions than the traditionally more open docroot.

May I ask why you need to change it?

A rewrite rule is by far the simplest route,if you can get it working. Failing that, if you’re on some form of Linux host, maybe set up a symbolic link from backend -> textpattern. That might work.


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#5 2024-03-09 19:46:30

Vienuolis
Member
From: Vilnius, Lithuania
Registered: 2009-06-14
Posts: 307
Website GitHub GitLab Twitter

Re: change admin_url

I allow open access to WWW publications, so for editing I have set up another virtual server (without installation) under a different, unpublished subdomain – where I accept only encrypted connections. One simple line is all it takes:

UrlToolkit {
	…
	Match ^/textpattern/ DenyAccess
	…
}

in Hiawatha configuration for the public website. Apache would have a bit more complex code in .htaccess (Hiawatha does not use it).

Everything works smoothly and reliably, despite Textpattern: Admin: Diagnostics warning:

Site URL preference might be incorrect.

Offline

Board footer

Powered by FluxBB