.htaccess reditrect subdirectory page to root - wordpress

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>

Related

WordPress domain redirection

Beginner question:
I need to perform a 301 redirect from one Wordpress site (domain), to another Wordpress domain, like this:
From:
http://mycompany.com
To:
http://mycompany.se
A problem is that I have no FTP credentials for my From-site. I can't reach the .htaccess file.
Is there a plugin to use? I have studied the Redirection plugin, but this one seems working on pages within the same domain only(?)
I guess I need to be careful, because if some plugin edits the .htaccess file and something breaks, I can't reach the file...
Thankful for any help!
Whit Redirection Plugin you can redirect a url from old to new website.
You can create and manage redirects quickly and easily without needing Apache or Nginx knowledge. If your WordPress supports permalinks then you can use Redirection to redirect any URL.
There is full support for regular expressions so you can create redirect patterns to match any number of URLs.
The plugin can also be configured to monitor when post or page permalinks are changed and automatically create a redirect to the new URL.
You can easily find multiple plugins to perform 301 redirection in wordpress,but if you want to edit .htaccess you can install the plugin called "WP htaccess control" https://wordpress.org/plugins/wp-htaccess-control/ .
Through this plugin you can edit the .hraccess file from admin side.
Thanks.

Moved Wordpress to a subdirectory, don't want site-url to redirect to my subdirectory

I've searched a while but couldn't find an answer to this question yet. I had WP originally installed in the site root and moved it to a subfolder and went through the common steps necessary. I do this because I want to run wordpress only for blogging reasons and keep another HTML site as my main project that I want to access through my domain www.example.com and the wordpress blog through www.example.com/blog/
I moved the WP system therefore to /blog and changed the site address and wp address to that folder and followed the usual steps. Everything works just fine. Still when I enter my domain it redirects automatically to the /blog subdirectory and not to the site that lies in the root that has a index.html. There is no .htaccess file in the root or anything similar. How is that possible? Happy about all suggestions.

Redirect image links from old blog (Wordpress multisite)

I have the following scenario:
Everything runs on a wordpress multisite
I used to have a blog on domain A
The blog posts from domain A got transferred to a new blog on domain B. The images on this new blog were still pointing to domain A and were working fine, until...
I created a new website on domain A with a different ID
Now the images on domain B point to domain A, to the upload folder of the old ID and they don't work anymore. I just copied the files from the old blog over to my new blog's ID's upload folder.
Now I guess I need to edit my htaccess file, which is the reason for this question. What's the code I need to use and where do I put it (I guess it goes in the main WP htaccess file)?
I need to redirect all image links from
http://domaina/wp-content/uploads/sites/5/XXXX/XX/XXX.xxx
to
http://domainb/wp-content/uploads/sites/9/XXXX/XX/XXX.xxx
I guess an alternative would be to do it in SQL and rewrite the permalinks, but that's quite high risk and I would prefer the htaccess solution...
If you want to use .htaccess than just put the redirects following the example
Redirect 301 /old-page.html http://new-domain.ru/new-page.html
and yes, use the main .htaccess in the root WP directory

htaccess Mod rewrite and permalink

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.

permanent redirect on wordpress site

I've got a web site based on wordpress, I need to temporarily hide the web site.
I thought about using a PHP 301 redirect. I tried to put at the begining of index.php and xmlrpc.php without success. How does wordpress file-structure works?
Tnx
Giuseppe
I've used this for redirects in the same purpose:
http://wordpress.org/extend/plugins/redirection/
I put the temporary html-file that I wanted to display in a folder which was placed in the same place as the main index.php file.
If you really need to hide a website under development, block search engines in Dashboard/Settings/Privacy and use something like WordPress › Absolute Privacy « WordPress Plugins to disable RSS feeds and redirect to a static page you choose.

Resources