I had a WordPress instance hosted on a subdirectory on a domain. I have now changed the domain and moved the WordPress setup to the root of a new domain.
I have set up .htaccess on the old domain root directory as follows.
Redirect 301 /subdirectory https://newdomain.com/
And it's working pretty well. But for some reason, the assets in the subdirectory chain are throwing 403 forbidden. The following pattern ends up with 403.
https://olddomain.com/subdirectory/wp-content/uploads/1.jpg
What I might be doing wrong here?
Related
I am trying to understand regex URL rewrites and redirects.
I need the following:
www.mydomain.com/tag/*/index.html (for example, mydomain.com/tag/winter-holidays/index.html or mydomain.com/tag/summer-holidays/index.html) to redirect to: www.mydomain.com/index.php/tag/WHATEVER/index.html
www.mydomain.com/*/ (for example, www.mydomain.com/four-roots-of-happy-living/, www.mydomain.com/four-roots-of-happy-living (without the ending slash), www.mydomain.com/living/, www.mydomain.com/living (without the ending slash) AND ALSO www.mydomain.com/category/happiness/ and www.mydomain.com/category/happiness (without the ending slash) to redirect to www.mydomain.com/index.php/WHATEVER/ or www.mydomain.com/index.php/WHATEVER/ WHATEVER/.
I have tried so many different combinations in my .htaccess file that my head is spinning now.
In my .htaccess (currently) I had this, but have deactivated it for the meantime until I can get this straight:
Redirect 301 /* /index.php/*
RedirectMatch 301 /*(.*)/? /index.php/$1
Note: My htaccess file was/is in my root directory, my WordPress site is in a wp folder off that, and it did not have a .htaccess file.
I host my website on DirectAdmin, the domain is redirected to example.com/wp, I have deleted all the wp files and redirect the domain to example.com/index.html, but nothings has been changed.
I also update the .htaccess file too
Directory Index index.html
Redirect 301 / http:example.com/index.html
but it still open the example.com/wp as the default page.
how I can force it to open the index.html page in public_html folder through the default domain?
I have moved a WordPress blog from subfolder to a subdomain.
Previous structure : www.sitename.com/fashion-blog
New structure is here :
www.blog.sitename.com
The WordPress has been moved to the root directory of sub domain. How can I redirect visitors using .htaccess so that if some one visits old URLs , they will be redirected to new URLs.
For example if some one visits:
http://www.sitename.com/fashion-blog/some-post.html
they should be redirected to its new URl as:
http://blog.sitename.com/some-post.html
Try putting this in your .htaccess file
RedirectMatch 301 /fashion-blog/some-post.html http://blog.sitename.com/some-post.html
I just combined 2 domains into one. i used the phpMyADmin Alias domain
settings (maybe that's the issues) to point the domain to the hosting...
Now, I want old domain / alias domain pages to redirect to corresponding pages in the new domain - this is a Wordpress site
I tried this
redirect 301 gispan-online.co.il/some-category/ http://www.gispanjewelry.co.il/some-category/
but it doesn't work.
I don't know if the problem is that this is a Wordpress site
and need other setting or that the server catches the redirect
before htaccess is loading or that I am just doing it wrong
Would appreciate your help on this matter.
You can use RedirectMatch directive :
redirectMatch 301 ^/(.*)$ http://www.gispanjewelry.co.il/$1/
I have a weird situation that's come up, so I'm hoping some one can help me out.
I have a wordpress installation in the root directory and a codeigniter installation in a subdirectory (I know, I know...). Both are working fine on their own. The codeigniter installation has its own .htaccess file for rewriting to index.php.
But what if I wanted a URL outside of the codeigniter directory to rewrite to the codeigniter directory, which will then be rewritten again by the CI .htaccess file.
For example:
example.com/2010/10/article-title is a URL used by wordpress. THIS WORKS
example.com/codeigniter/ is the root of codeigniter. THIS WORKS
example.com/codeigniter/controller/action is a CI URL. THIS WORKS
But what if I wanted to point
example.com/users/list to example.com/codeigniter/users/list
and then have this be properly rewritten by CI?
Is this possible to do without a hard redirect?
In your root directory .htaccess write above the WordPress rules:
RedirectMatch Permanent ^/users/(.*) /codeigniter/users/$1