I have an issue doing url rewriting in php in a subfolder because of my Wordpress blog

So I have a wordpress blog based in the root folder /. Besides that I have a sub domain in a subfolder. I want to do url rewriting in this subfolder (it's done in php with a 404 redirection rule in a .htaccess file). The redirection of the .htaccess is supposed to redirect to /subfolder/index.php .

My problem is that it doesn't work once it's uploaded on the server. The url http://mywebsite.com/subfolder/the-file-im-lookingfor.html keeps redirecting to the 404 error page of my wordpress blog.

I guess this is because of the url rewriting of Wordpress. Is there any way I can solve that?

Thanks in advance!

Solutions

If you have a 404 redirection rule, i.e. a flag in your htaccess that looks like this:

[R=404]

Then you are sending the browser a 404 HTTP response, so it definitely will send the browser to your 404 page. You may have meant to send a 301 redirect.

The way I would handle a subdomain is to set up virtual hosts in your httpd.conf file and set the DocumentRoot to /subfolder for the subdomain. Then, you can handle their rewrite rules separately by putting separate htaccess files in each folder.

Tags: PHP / Wordpress / .htaccess

Similar questions

WP in subfolder hidden by htaccess, but media links show the subfolder
The WordPress install is in /public_html/example. In the .htaccess file in public_html I have this code: In /public_html/example I have exactly the same file. So when I access the site, all the pages have URLs such as http://example.com/about. The URL rewriting specified in .htaccess is working. But the rewriting does not work for media files, whic...
.htaccess Redirect Subfolder but excluse sub-subfolder?
I want to redirect any URL request from /wp/ to /register/ However, if the URL request is /wp/wp-content/ or any subfolder of /wp/wp-content/, then I want to ignore the redirect and allow it through. How can I do this simple conditional redirect using .htaccess? I've tried for an hour with no luck. Thanks.
.htaccess show subfolder contents on root only but don't show subfolder in address bar
This is what I currently have in my .htaccess file This simply redirects to the subfolder, but I would also like to prevent the subfolder showing in the browser's address bar, and I would only like this to happen on root (main domain page), and all other file requests should go normally, without any redirection at all. I have tried many solutions h...
Want to have my wordpress blog in a subfolder instead of root; getting 403 error(obviously). How can I fix this?
So yeah, just installed wordpress not too long ago, I set everything up and got up to the dashboard. I made a test post and I got a 403 error. I also clicked the top of my dashboard which should take me to the main page of my wordpress blog and it failed as well. This isn't really surprising since my wordpress is in the folder blog of my root direc...
Route Wordpress Blog to Rails Subfolder - Blog Links Not Changed
I currently have a Rails app, my_app.com, and an associated Wordpress blog, blog.my_app.com. They are both running independently on Heroku (i.e. no Apache or Nginx scripting) I am trying to move the blog into a sub-folder of the Rails app, my_app.com/blog without losing any of the blog's existing SEO 'juice'. I've implemented the rack-reverse-proxy...
wordpress url rewriting issue for one page or post
http://www.example.com/this-is-a-test-title/93/ http://www.example.com/this-is-a-test-title2/93/ http://www.example.com/this-is-a-test-title3/93/ All these urls should point to http://www.example.com/?p=93 any string after example.com/%%%%%%/93 should needs to point to http://www.example.com/?p=93 Its should works only particular post id = 93 Only.

Also ask

We use cookies to deliver the best possible experience on our website. By continuing to use this site, accepting or closing this box, you consent to our use of cookies. To learn more, visit our privacy policy.