My website have structure like this:
In root domain I have static html page "portfolio" (which I won't need it anymore, becauose I'll create it in wordpress):
http://www.natasamedvesek.com/
and I have installed wordpress for blog in subdirectory:
"natasamedvesek.com/blog/"
Now I have also all my pages structured like this "/blog/about" , "/blog/info" .... .
Now I'm asking what to do:
(1) move wordpress instalation from subdirectory "blog" to root directory.
or
(1) leave wordpress instalation as it is, in subdirectory "blog" and create redirect 301
My new structure would look like this:
"natasamedvesek.com" ---> portfolio "natasamedvesek.com/about" ---->
page "about" "natasamedvesek.com/info" ----> page "info" . . .
"natasamedvesek.com/blog/" ---> page of postsIt's very important that I won't lost all my existing likes and shares from facebook, from all of my posts? What about my existing rank for SEO on google?
If I do create redirect 301, what I have to do?
Is this correct way, if I would put this code in .htaccess file
#Options +FollowSymLinks
RewriteEngine on
RewriteRule ^(.*)$ http://www.natasamedvesek.COM/$1 [R=301,L]
Thanks for answers
It's much easier than using redirects; you can use the pre-existing subdirectory install and have admin at /blog/ while root appears to be at root.
From Giving WordPress Its Own Directory « Using a pre-existing subdirectory install
1) Go to the General panel.
2) In the box for Site address (URL): change the address to the root directory's URL http://www.natasamedvesek.com
3) Click Save Changes. (Do not worry about the error message and do not try to see your site at this point).
4) Copy (NOT MOVE!) the index.php and .htaccess files from the blog directory into the root directory of your site.
5) Edit your root directory's index.php. Open your root directory's index.php file in a text editor. Change the line that says:
require( dirname( __FILE__ ) . '/wp-blog-header.php' );
to the following, using your directory name for the WordPress core files:
require( dirname( __FILE__ ) . '/blog/wp-blog-header.php' );
and save the file.
6) Login to your site (if you aren't still already). The admin URL should still be http://www.natasamedvesek.com/blog/wp-admin/
7) If you have set up Permalinks, go to the Permalinks panel and update your Permalink structure. WordPress will automatically update your .htaccess file if it has the appropriate file permissions. If WordPress can't write to your .htaccess file, it will display the new rewrite rules to you, which you should manually copy into your .htaccess file (in the same directory as the main index.php file.)
very important that I won't lost all my existing likes and shares from
facebook...
You will lose your Facebook shares because the URL is changing, and there is no way to change an incoming Facebook link. And your SEO will take a temporary hit because you are changing URLs, at least until Google reindexes the site.
Related
I have a local wordpress website on IP "192.168.0.115".
There is a page in it called "Invoice" ("192.168.0.115/invoice").
I have about 800 PDF (invoice) files.
I would like their URL to be "192.168.0.115/invoice/invoice001.pdf", "...002.pdf" and so on.
What I did:
I made a folder called "invoice" in the htdocs folder next to "wp-admin", "wp-content" and "wp-includes" where I put all 800 PDF files.
It worked out - when I entered the URL "192.168.0.115/invoice/invoice001.pdf" it opened the desired PDF file.
But when I entered the url "192.168.0.115/invoice" I had no longer access to the page "Invoice".
Instead I got all of the files listed as in a folder through the browser.
I couldn't access the page, because of the same folder name and same page name -> "invoice".
My question:
Is there any way I can tell wordpress to ignore the folder called "invoice" and load the page with URL "192.168.0.115/invoice" AND in the same time open files with URL "192.168.0.115/invoice/invoice001.pdf"?
If you are using apache you can add a rewrite rule to your .htaccess file.
You can't have a WordPress page and a folder named that same thing. So the first thing you need to do is change your folder name from invoice to my-invoices. Then you add this rule to your .htaccess file:
RewriteRule ^invoice/(.*).pdf$ my-invoices/$1.pdf
Don't forget to rename your folder, but leave your WordPress page slug.
Then you'll be able to go to each of these URLs:
http://192.168.0.115/invoice/
http://192.168.0.115/invoice/invoice001.pdf
Be sure to place your new rewrite rule above the ones for WordPress.
I use to have wordpress installed on the root of the website, but today I moved to a subdirectory "root/blog" with these steps:
1) Moved all the files>
2) Copied .htaccess and index.php do "root" and modify them
3) Change the wordpress URL on the settings.
It worked fine.
But I don't want it be accessed via www.mysite.com. I want to be access as www.mysite.com/blog. I want to do my own main index.
But if I remove the index.php from root, it gives me problems like /blog won't find my static first page.
What I'm missing?
You need to change your apache virtualhosts settings.
More infos here.
I've installed wordpress into a inner directory. like root/mysite . Why I didn't install it on root because there are so many addon domain installed, and I literally don't want to mess all addon domain folders with wordpress files inside root directory. My root directory is for www.example.com . And my wordpress site I've installed on root/mysite, so the url for that is www.example.com/mysites . Is there anyway to redirect www.example.com/mysites to www.example.com . As I said the only reason for not installing wordpress on my root, because I don't want to mess wordpress files, folders with other addon domain's folders on root.
So my main goal is showing a wordpress site on www.jimfahad.com that is installed on www.example.com/mysites. Is there any way?
Yes, you can leave the WordPress install and folders in mysites, but you have to copy the .htaccessfile and the index.php file to root. This will result in the visual URL of WordPress being in root (example.com), but the uploads, theme URLs, etc, being in example.com/mysites.
See the WordPress Codex > Giving WordPress Its Own Directory « Using a pre-existing subdirectory install on how to copy and edit the files:
1) Go to the General settings panel.
2) In the box for Site address (URL): change the address to the root
directory's URL. Example: http://example.com
3) Click Save Changes. (Do not worry about the error message and do
not try to see your blog at this point! You will probably get a
message about file not found.)
4) Copy (NOT MOVE!) the index.php and .htaccess files from the
WordPress (wordpress in our example) directory into the root directory
of your site—the latter is probably named something like www or
public_html. The .htaccess file is invisible, so you may have to set
your FTP client to show hidden files. If you are not using pretty
permalinks, then you may not have a .htaccess file. If you are running
WordPress on a Windows (IIS) server and are using pretty permalinks,
you'll have a web.config rather than a .htaccess file in your
WordPress directory.
5) Edit your root directory's index.php:
6) Open your root directory's index.php file in a text editor. Change
the line that says:
require( dirname( __FILE__ ) . '/wp-blog-header.php' );
to the following, using your directory name for the WordPress core
files:
require( dirname( __FILE__ ) . '/wordpress/wp-blog-header.php' );
and save the file.
7) Login to your site (if you aren't still already). The URL should
still be http://example.com/wordpress/wp-admin/
8) If you have set up Permalinks, go to the Permalinks panel and
update your Permalink structure. WordPress will automatically update
your .htaccess file if it has the appropriate file permissions. If
WordPress can't write to your .htaccess file, it will display the new
rewrite rules to you, which you should manually copy into your
.htaccess file (in the same directory as the main index.php file.)
I setup WordPress in our server's different folder so url look like domain.com/wordpress
Then I created blog page so my blog url look like do domain.com/wordpress/blog
Now i try to change domain.com/wordpress/blog to domain.com/blog.
The general approach to running WordPress from a subdirectory is as follows:
1) Under Settings > General, set WordPress address (URL) to:
domain.com/wordpress
This is the actual location of your WordPress installation. Also set Site address (URL) to:
domain.com
This is what you want the user to enter to get to your site. Save the changes.
2) Copy the .htaccess and index.php files from your WordPress directory into your root directory. Edit the index.php file and change:
require( dirname( __FILE__ ) . '/wp-blog-header.php' );
to
require( dirname( __FILE__ ) . '/wordpress/wp-blog-header.php' );
This sends connection requests to the correct directory.
3) Login to your WordPress admin, which should be at domain.com/wordpress/wp-admin/. Go to Settings > Permalinks and click Save. This will update your permalinks.
You should now be running the way you wanted.
My website is being displayed at two locations: one in the root like www.website.com like I want it to, and the other is displayed at www.website.com/wordpress, which I don't want.
In the folder structure of my website, I installed WordPress in a subdirectory called wordpress, copied the index.php file to the root, and amended this to make it point at the subdirectory: require( dirname( __FILE__ ) . '/wordpress/wp-blog-header.php' );
Is this normal behaviour, and can I somehow have my website be display only at www.website.com?
I just spun up a development instance, and tried going through the process, and I got the same result. I was able to fix it by renaming the index.php that is NOT in the root to useless.php. That made the /wordpress portion of the site 503, and it kept the root portion of the site running. Try it and let me know if it works!