My site is set up with 2 CMS syatems
In the root domain there is a Joomla website and in another directory called /word/ there is a wordpress directory.
The site originally was the wordpress site and this was moved to /word/ directory but to maintain all the original url's, I used mod_rewrite which works great until I insert the mod_rewrite for the Joomla site.
The mod_rewrite works great for the Joomla site but blocks all access to /word/ directory and 404 errors are thrown up. And if I leave the Joomla code out of the .htaccess I am left with the trailing /index.php/page name.
I have in my .htaccess file (This stops access to the /word/directory)
# Begin Joomla
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /word/index.php [L]
</IfModule>
# END WordPress
How can these 2 live together?
Joomla comes with its own .htaccess template which should be in the root folder and called htaccess.txt. Usually, I would rename to .htaccess and then un-comment this line:
# RewriteBase /
to:
RewriteBase /
My suggest would be to replace your "Joomla" section with the one provided by Joomla and see if that does the trick.
Related
I have a Wordpress site that has a rewrite rule. I also have a non-wordpress folder, but I can't access it because of this rule. So I read that i should enter RewriteEngine Off in the htaccess of the non-wordpress folder, unfortunately I still get an Error 404 on that page (it works fine if I remove the Wordpress rewrite).
Here is the htaccess in the root:
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
What am I doing wrong?
Many thanks!
Matt
Add this right under RewriteBase /:
RewriteRule ^folder/ - [L]
where folder is the folder you want to exclude.
I've got a server that has in its root directory a bunch of subdirectories, one of which has a WordPress.
directory1
directory2
wordpress
directory3
All of these except for the WordPress were migrated from a Windows server to a Linux server which means that we've lost case insensitivity.
I want the WordPress to be able to serve a URL like http://www.example.com/~subdomain, so there's an index file in the root directory. I also have two .htaccess files, one in the WordPress and one in the root directory.
The following is the root directory's .htaccess.
This is where I'd like to put mod_speling's case insensitivity directives, but it conflicts with the rewrite rule.
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /~subdomain/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /~subdomain/index.php [L]
</IfModule>
# END WordPress
Below is the WordPress subdirectory's .htaccess
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /~subdomain/wordpress/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /~subdomain/wordpress/index.php [L]
</IfModule>
# END WordPress
I've tried using a symlink in the root directory to point to the WordPress directory's index.php. I set the symlink to be the DirectoryIndex but unfortunately it results in a lot of the links turning into 404s.
At this point I'm kind of stuck. Any ideas?
I've set up a Wordpress blog on Heroku using the great tips here - http://blog.pardner.com/2012/04/migrating-a-wordpress-blog-to-heroku/. Everything seems to be working fine with the default permalinks (http://www.mysite.com/blog/?p=123), but if I try to switch to permalinks that use the post name - I run into problems. It seems to work fine after switching the settings and saving them, but after a few hours (maybe when the temporary filesystem of Heroku goes away?), it stops working, and trying to access posts redirects me to my site's main page .
I implemented the changes to .htaccess as described in the above link , so my .htaccess file looks like this:
Options -Indexes
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
Fixed it. Since my blog was placed at http://www.mysite.com/blog/ and not at http://www.mysite.com/, the .htaacces file should look like this:
Options -Indexes
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /blog/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /blog/index.php [L]
</IfModule>
# END WordPress
I have a wordpress hosting site www.mysite.com/myBlog . The wordpress installation is done inside public_html/www/myBlog folder inside my host folder.
I also have a folder public_html/www/myName which redirects me to a domain myName.com
Although this works fine but inside myName folder i have files like index.html. acad.html, worexp.html
clicking on them i expect a behavior like
myName.com/index.html
myName.com/acad.html
myName.com/workex.html
though i get it as myname.com only.
I found htaccess rules in myName folder as :
Redirect http://mydomainName.com/myName/+
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
RewriteCond %{HTTP_HOST} ^mydomainName.com$
RewriteRule ^/?$ "http\:\/\/www\.mydomainName\.com\/myBlog" [R=301,L]
Can anyone help me with whats wrong with the htaccess file ?
More details:
My WordPress blog has something messed up. I can go to my blog and homepage works fine but when i try to go to any post it throws an 403 error. Apache forbidden.
Tried talking to web host for permissions its ok.
checked htaccess. Replaced code by default code stil not working.
Removed permalinks to default deleted htaccess created new permalinks.
Gave permissions to all the files in blog directory
Rewrote robots.txt Blog url is : www.windowsvj.com
Wordpress community is not able to suggest something very helpful too.
Current Redirect rule code in .htaccess is :
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /wpblog/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /wpblog/index.php [L]
</IfModule>
# END WordPress
This could be the result of FollowSymLinks being disabled in the server configuration. Simply adding Options +FollowSymlinks to the .htaccess file could do the trick.
Instead of using the flag [L]
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /wpblog/
RewriteRule ^index\.php$ - [L] <---
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /wpblog/index.php [L] <---
</IfModule>
# END WordPress
Try using [QSA]
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /wpblog/
RewriteRule ^index\.php$ - [QSA] <---
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /wpblog/index.php [QSA] <---
</IfModule>
# END WordPress
How [L] works is if the RewriteRule matches
RewriteRule . /wpblog/index.php [L]
Then all other rewrites after this RewriteRule are ignored as stated on the Apache website
"In most contexts, this means that if the rule matches, no further rules will be processed." http://httpd.apache.org/docs/current/rewrite/flags.html
Here is a link with more information on .htaccess flags
http://httpd.apache.org/docs/current/rewrite/flags.html
Hope this works for you :P
I have a postNuke site that I'm currently transferring to Wordpress and I would like the format of the old site not to be lost in the conversion. I've tried to play with it but I'm going nowhere fast!
The current site currently rewrites the URL to :
domain.com/Article1234.html
where 1234 is the internal id number of the article.
The ID in the old site is the same in the new site. The URL in the new wordpress site currently rewrites to a custom structure :
/%category%/%postname%
Here is what is in the .htaccess file:
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
What is needed to be done to redirect the old format to the new one? Change rewrite rule in htaccess? 301 redirect? wordpress plugin for rewriting?
If you don't have a lot of articles, you can use RedirectPermanent, but you have to write yourself the directives in your .htaccess file.
Or you can use .htaccess like this
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteRule ^Article([0-9]+)\.html$ /index.php?p=$1 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
This will rewrite Article1234.html to index.php?p=1234, then wordpress will make a 301 redirection.
Be careful when modifying permalinks since .htaccess could be override, to avoid this you can place custom rewrite rules before # BEGIN WordPress.