How to change .../wp-admin/... (not just the login page) - wordpress

As a process of white labeling WordPress websites for my clients I was wondering if I can mask admin panel URLs from these:
https://www.somerandomaddress.com/wp-admin/index.php
https://www.somerandomaddress.com/wp-admin/post.php?post=12&action=edit
to these:
https://www.somerandomaddress.com/admin/index.php
https://www.somerandomaddress.com/admin/post.php?post=12&action=edit
Preferably I don't want to change core WordPress code so official WordPress updates can be applied without any problem.

You need to modify your .htaccess in order to wp work as before and see the url only changed.
Try this:
RewriteRule ^wp-admin/(.*)$ /admin/$1 [QSA,L]

For that you can use the plugin
Protect Your Admin

Related

Wordpress menu items are not https links

I want to use https instead of http on my wordpress site. The site is now running https and there is only one problem.
short facts of my past steps.
Change the site and home url over the admin backend from http to https.
Use Search and Replace Plugin and search http://'url' and change to https://'url' for all tables and fields except the guid.
Now the issue.
My site works over https with every page but the wordpress site generate for the menu only http links. There are 3 menues of the site and every menu has only http menus. Why? How does Wordpress generate these links?
In case you never figured it out, I just did after encountering this issue lately and finding this question.
In current WP admin go to Settings > General.
Then simply add s after http.
Based on the actions you have already taken, there are two possible cases (assuming your menus haven't been defined by a plugin):
Menu links are improperly hard-coded in template files.
If this is the case, you will need to find the relevant template files in your active theme (or create a child theme) and edit them. The proper way of defining hard-coded links in this case (if they must be hard-coded) is to use template tag functions such as site_url(), which will automatically prefix links with the proper scheme and URL.
Custom links have been defined in menus, in the WP-Admin.
If this is the case, you can head to WordPress Admin --> Appearance --> Menus and edit the custom links in each of your menu items.
Have you thought about using:-
https://en-gb.wordpress.org/plugins/wp-force-ssl/
This will force all of your internal links to use https://
It's the same as #SergeyAn answer but you don't have to edit the .htaccess file directly.
You can try to use htaccess rules like this:
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}

How to access Wordpress admin panel after integration with Codeigniter?

In the company where I work we used to have Wordpress on its own subdomain, like blog.ourwebsite.com. We decided that it would've been better to have it in the main domain, like: ourwebsite.com/blog. Also, we want it perfectly integrate with our current design, so the blog should load inside the website showing just the posts, while the header and the footer will be the one of our website. Our website is built with Codeigniter.
I've read different articles and questions about how to integrate the two platforms and in the end we opted for putting Wordpress inside the root directory of the Codeigniter installation, so that it looks like this:
ourwebsite/
application/
system/
wordpress_blog/
In the Codeigniter index.php I am loading Wordpress with this instruction:
require_once './wpblog/wp-blog-header.php';
I put it on top, so before loading the codeigniter core. At this point the only problem was the site_url function conflict which I solved by renaming it in Codeigniter. So, everything seems to work fine except that I have no idea how to access the Wordpress administration panel.
I then created a blog controller and I can now call Wordpress functions inside the Codeigniter view. So at this point the Wordpress content is displayed correctly. The problem is that I have no idea how to access the Wordpress admin panel. If I try to access localhost/ourwebsite/en/blog/wp-admin I, of course, get an error, because it's trying to access a wp-admin function inside the controller, which doesn't exist. So I was thinking to access directly the directory with something like localhost/ourwebsite/wordpress_blog/wp-admin (wordpress_blog is the name of the directory on disk, which is different from the controller name), but I get a 404 error. I also added this directory to the Codeigniter .htaccess file that now looks like this:
RewriteEngine on
RewriteBase /ourwebsite/
RewriteCond $1 !^(index\.php|wordpress_blog|cache|captcha|fonts|forum|media|img|min|css|js|scripts|images|uploads|docs|robots.txt|sitemap.xml|sitemap|public|tools|assets|xd_receiver.htm)
RewriteRule ^(.*)$ index.php/$1 [L]
Any idea?
EDIT:
I tried accessing directly the wp-login.php file, at http://localhost/~carlo/ourwebsite/wordpress_blog/wp-login.php. This actually works. The thing is that when I try to login it redirects me to a wrong url, which is: http://localhost/~carlo/ourwebsite/wordpress_blog/wp-admin/localhost/~carlo/ourwebsite/wordpress_blog/wp-login.php?redirect_to=http%3A%2F%2Flocalhost%2F~carlo%2Fourwebsite%2Fwpblog%2Fwp-admin%2F&reauth=1.
The thing is that it logged me in anyway, so if I try to access the admin panel again, now, it kind of works. I can see it but it's like it has no css or javascript files loaded.
ok then try to change the wordpress siteurl in option table. it should be like localhost/ourwebsite/wordpress_blog/..
and check your
localhost/ourwebsite/wordpress_blog/wp-admin
edited 2/11/2014
define('WP_HOME','http://localhost/~carlo/ourwebsite/wordpress_blog/');
define('WP_SITEURL','http://localhost/~carlo/ourwebsite/wordpress_blog/');
you are missing "http://"

How to internally add /blog/ to the url with .htaccess?

Hi I have wordpress installation in subfolder /blog/, as it has to co-exist with other legacy cms, so now if i wish to access some page of wordpress i need to use links as
www.domain.com/blog/news/ and would like to rather use www.domain.com/news/.
So basically for certain links i need to add this /blog/ somehow internally so wordpress
would handle it normally.
Please note it will be few links so rewrite rules can be literal.
Rewriting URI's for wordpress can always be kind of sketchy because wordpress has its own way to do routing and may not play nicely with other rewriting sometimes, but you can try:
RewriteRule ^/?news/some-page$ /blog/news/some-page [L]
As long as they're before any other wordpress related rules.

Wordpress Blog URL

For some reason my blog posts are creating their own URL's.
Blog is on www.website.com/blog/ but when I make a new post, the new post URL is www.website.com/new-post-url/.
What I want is for the blog posts URL to be www.website.com/blog/new-post-url/ as their URL.
I use All in One SEO as my SEO plugin (if that matters).
You should check your blog setting.
login as administrator and go Settings >> General Settings
check here Site Address (URL). This should be http://www.website.com/blog
Hope this is helpful.
all the best ;)
#user1667462
Have you checked your .htaccess file?
Because you when you're having /blog kind of redirect to your WordPress Blog then you must have to add below code in your .htaccess file
RewriteEngine On
RewriteCond %{HTTP_HOST} ^(www.)?website.com$
RewriteRule ^(/)?$ blog [L]
Go to Settings -> PermaLinks from Dashboard and select Custom Structure
give /blog/%postname%/
Check your blog by going to any post/page.
Log into your Wordpress admin panel and check to ensure that permalinks are set to the appropriate settings. Also check to make sure that your theme is not overriding the settings you might have chosen. Some themes for example can explicitly request you set a blog page for the blog posting which can interfere with what you assume to be happening.
Your go to admin page and click setting page, change the url types.

Moving Wordpress to another domain with different permalinks

I want to move Wordpress to another domain and also change the permalinks. So basically what I want is to move from: oldsite.com/PostId-PostName.html to newsite.com/PostName/
I know this can be done from .htaccess, but I don't manage to get it right. Can you please help me ?
This is how it can be done using Apache's mod_rewrite:
# Activate Rewrite Engine
RewriteEngine On
# redirect posts to new site
RewriteRule ^(\d+)-([^/]+)\.html http://www.newsite.com/$2/ [R=301,NC,QSA,L]
This will ONLY redirect URLs like oldsite.com/12345-very-interesting-post.html.
There is a Codex article dedicated to this: Moving WordPress

Resources