htaccess Mod rewrite and permalink - wordpress

I have a WordPress website where the requirement is exactly like below:
WordPress site should be installed on: http://www.mydomain.com/wp/ |
Website homepage should be access from: http://www.mydomain.com/ if someone visits http://www.mydomain.com/wp/ he should be redirect to http://www.mydomain.com/
But when accessing all other inner pages, visitors should follow the URL format:
http://www.mydomain.com/wp/test-page1
http://www.mydomain.com/wp/test-page1
This means I need the main website access from main domain directly but all other inner pages should open under sub-directory as mentioned above.
how can I do that with .htaccess? Thanks

Please look into this website about htaccess redirects: http://htaccess.wordpress.com/2008/09/15/redirecting-urls-in-htaccess/
Aside from that, you will want to have your RewriteBase to be / and not wp so that the user doesn't go to wp subfolder automatically.

Related

Cannot able to access wp-admin page

I have a wordpress website in my ubuntu server. Eg, my website url is
xyz.com. when i'm trying to access wp-admin page it should be xyz.com/wp-admin. But it redirect to another url like xyz.com/xyz/wp-admin
Can anyone give solution for this issue?
Wordpress admin dashboard is /wp-admin from whatever directory your website is installed.
For instance, you have a website https://dijofrancis.com and wp is installed in the root directory then your admin url is https://dijofrancis.com/wp-admin
If you paste your .htaccess file (situated at the root of your webserver directory) we could help a little more.
I once had a similar issue when I stupidly made a global redirect with a wildcard on my website.
If you say that when you access:
xyz.com/wp-admin
it redirects you to
xyz.com/xyz/wp-admin
Then it might be a permalink issue.
Re-make your permalinks from WP dashboard.
Also, you can try to use
https://wordpress.org/plugins/wps-hide-login/
and test from another link (if issue is permalink, maybe WPS HL will interact with wp-admin in a way that will work for some reason)

htaccess, rewriteurl to page of WordPress site in sub-folder

Here's the scenario, I have a single server and two WordPress sites living in their respective sub-folders:
public_html/site_one/
public_html/site_two/
These sites display as follows:
www.site.com/site_one/
www.site.com/site_two/
The second of those sites has a splash page / landing page:
www.site.com/site_two/landing-page/
...that needs to display in the root of the site:
www.site.com/
I'm aware that there are better ways of achieving this, but I'm restricted to working with how it's currently set up.
Initially I thought I would be able to set up a .htaccess file in the root that rewrites access to the root of the site to display the landing page from site_two, but this isn't working as expected. This is the .htaccess file from the root of the server:
RewriteRule ^$ subfolder/page-slug [L]
This redirects to the site's front page. If I replace page-slug with ?p=1234 then it displays as the correct page but also seems to redirect to the landing page's full URL.
Is there any means of achieving what I'm after?
To clarify:
User visits site.com
URL displays as site.com
Page displayed is site.com/site_two/landing-page/
I've managed to have this behaviour working when not linking to a WordPress page (using a test index.php in 'test-subfolder') but WordPress and its own .htaccess file seems to be confusing matters.
Any help would be appreciated. Is there a way of excluding the landing page from the WP .htaccess file and what is it about the WP .htaccess file that's stopping the page being displayed at the root of the site?

.htaccess reditrect subdirectory page to root

I got a website running and in the subdirectory domain.com/blog/ I installed a Wordpress blog website. The subdirectory contains dozen of blog articles, for example
domain .com/blog/testing
domain .com/blog/example
domain .com/blog/article1
domain .com/blog/article2
And what I am trying to do is to rewrite and redirect (a single page) domain.com/blog/example to domain.com/example
Any way to do this?
It seems javascript redirect is better than htaccess redirect for your case.
Simply edit your article using a code editor in wordpress.
<script>window.location = "http://www.yourhomepage.com";</script>

Change only the home URL in my WordPress site

I have a WordPress website and the home page is configured to be the latest posts
What I want is that only the homepage URL that is, e.g. www.test.com redirects to subdomain.test.com and when the user needs to visit the older homepage will only access through test.com/home.
I need this because we will start a campaign in a landing page (subdomain.test.com) today.
But this is only for a few days, it is not a permanent change. How can I achieve this?
you can create a new page in WP where you can redirect to your sub domain.
OR
you can do this to make some changes in .htaccess file
RedirectMatch 301 ^/$ http://newsite.com.in/
add this in .htaccess file

How to put Wordpress into a subfolder and redirect all specific traffic to it?

I have a website in main folder with urls like:
domain.com/article/one etc.
Also i would like to install Wordpress into folder:
wordpress
But i would like urls to be NOT:
domain.com/wordpress/post/....
But:
domain.com/post/...
I would like to handle with .htaccess or index.php all requests to Wordpress so they are redirected to proper place in wordpress folder, so the main application will be intact.
How to make sure my basic app and wordpress will work together nicely?
change wp-options table value of home url and site url
what you want like abc.com
and move your content to main directory where you want like public_html/

Resources