: Inserting WordPress in a site with .htaccess Rewrite Rule I want to insert a WordPress blog in a website which is programmed in PHP and that uses includes() to select what content to show,
I want to insert a WordPress blog in a website which is programmed in PHP and that uses includes() to select what content to show, and that uses .htaccess Rewrite Rule to get friendly URLs.
The problem is that when installing WordPress in a subdirectory the rewriteRule executes and doesn't let the user get to the subdirectory where WordPress is located.
One way to solve this could be trying to program the includes to include all the WordPress content, but I think it would be quite difficult (wouldn't it?). Advantage: CSS style preserved!
The other solution I thought about was disabling the Rewrite Rule for the WordPress subdirectory (is it possible? How can it be done?). Disadvantage: CSS nod preserved, should be reinserted modifying WordPress files.
The third way I see is to install WordPress in a subdirectory, although I don't want to use this due to SEO optimization.
.htaccess file:
# Activar RewriteEngine
RewriteEngine on
# When only 1 var is set in the url
RewriteRule ^([a-zA-Z0-9-]+)/?$ index.php?lang=
# When 2 vars are set in the url
RewriteRule ^([a-zA-Z0-9-]+)/([a-zA-Z0-9-]+)?$ index.php?lang=&link0=
# When 3 vars are set in the url
RewriteRule ^([a-zA-Z0-9-]+)/([a-zA-Z0-9-]+)/([a-zA-Z0-9-]+)/?$ index.php?lang=&link0=&link1=
# When 4 vars are set in the url
RewriteRule ^([a-zA-Z0-9-]+)/([a-zA-Z0-9-]+)/([a-zA-Z0-9-]+)/([a-zA-Z0-9-]+)/?$ index.php?lang=&link0=&link1=&link2=
# When 5 vars are set in the url
RewriteRule ^([a-zA-Z0-9-]+)/([a-zA-Z0-9-]+)/([a-zA-Z0-9-]+)/([a-zA-Z0-9-]+)/([a-zA-Z0-9-]+)/?$ index.php?lang=&link0=&link1=&link2=&link3=
More posts by @Hamm4606531
1 Comments
Sorted by latest first Latest Oldest Best
You are going to have massive problems if you try to run WordPress out of a directory that also serves up non-WordPress PHP files. Trust me; I did this for several years. You will have add a rule to .htaccess, above WordPress's own, to intercept every single request that shouldn't go to WordPress. If all of the content is of the form /foo-bar-something.php, that's easy. Otherwise, that's a nightmare. Just put it in a different directory/subdirectory.
Terms of Use Create Support ticket Your support tickets Stock Market News! © vmapp.org2024 All Rights reserved.