Reputation: 199
Here's the deal... in a shared hosting, I created a subdomain like blog.mydomain.com in order to install wordpress, when i did that in cpanel it created a subfolder inside the root like public/blog. So the installation goes well but, when I visit blog.mydomain url, it changes to blog.mydomain.com/blog I wanna remove the last /blog, also it shows Can't find the page, but not as a error just like a post that doesn't exists.
In the codex page from wordpress it says that the first thing to do is go to dashboard > general panel and change the box for WordPress address (URL) and the box for Site address (URL) but in my general panel settings this options does not show up, I belive this is a thing from the installation.
I'm guessing that I can accomplish this from the .htaccess, btw here's the one that wordpress created:
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
# add a trailing slash to /wp-admin
RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) $2 [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L]
RewriteRule . index.php [L]
Do I have to modify this .htaccess?? if so, how to do that?? or the one in the root folder, considering that the root one is for a laravel application which resides in the main domain.
This is the main .htaccess
<IfModule mod_rewrite.c>
#LARAVEL
Options -MultiViews
RewriteEngine On
RewriteRule ^(.*)/$ /$1 [L,R=301]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
#END LARAVEL
</IfModule>
Hope someone can help me, Thanx...
Upvotes: 1
Views: 1707
Reputation: 21
Step 1 open the wp-config.php file in the root, find for
define('WP_HOME','http://blog.mydomain.com/blog'); define('WP_SITEURL','http://blog.mydomain.com');
Step 2 Copy the "index.php" and ".htaccess" files from the new subdirectory into the root directory.
Step 3 Open the "index.php" file in the root directory with a text editor. Look for the line that says: require('./wp-blog-header.php'); Replace that line with this line: require('./blog/wp-blog-header.php');
Step 4 Open your Web browser to the following address site url blog.mydomain.com admin url is blog.mydomain.com/blog/wp-admin
Upvotes: 0
Reputation:
1)login to admin of your website and update the website url to
blog.mydomain.com
2)open the wp-config.php file in the root, find for
define('WP_HOME','http://example.com');
define('WP_SITEURL','http://example.com');
and make the changes and also update the functions.php file in theme folder.
3) update the website url in wp_options table in your database.
Upvotes: 1