I have a VPS with LAMP installed, on which I run several websites, each of them redirected via CNAME to a subfolder /domain.com/htdocs.
One of these websites is a wordpress. I'm trying to activate permalinks for my pages. Following the directions of this tutorial I've tried to modify the config of the apache2/sites-available/domain.com file to change the AllowOverride None to AllowOverride All.
I'm still getting the same 404 error :
The requested URL /page-name/ was not found on this server.
I've checked on my FTP, my .htaccess file exists and has the correct permalink redirect:
# 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
The only way I've managed to activate permalinks is by putting index.php/ before it:
mywebsite.com/index.php/page-name/
Any idea on how to fix this? Would be immensely grateful, I've been trying to make this work for hours now!
Thanks in advance,
Arthur
Solved it myself. I just needed to load the mod_rewrite module with the command a2enmod rewrite.
Hope that'll help someone!
Related
I have migrated my site : http://www.mahodadhiinfra.com/ recently from windows hosting to linux hosting.
After it hosted and configured homepage running properly but unable to access any other page. i can only access page with a extension.
Ex.
http://www.mahodadhiinfra.com/wp-login.php (Working)
http://www.mahodadhiinfra.com/my-account/lost-password/ (Not working)
Initially I thought it might be a .htaccess issue but my .htaccess seems to be ok.
# 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
After that I tried with permalink change. But nothing worked. Hosting provider confirm that all settings are open what a wordpress required, e.g. AllowOverride ALL etc.
Can anyone please help me to get out of the issue?
Just 3 steps can help you:
Delete the .htaccess file
Login in /wp-admin/
Go to Permalink options and click "Save".
I have moved wordpress site to production server from test server. I have done database, code configuration changes. The strange problem i am facing is if i call my website adding index.php then only it shows the site.
http://www.suziesellsaz.com/index.php
If i directly call using domain name it is not working
http://www.suziesellsaz.com
I have thought problem may be because of .htaccess so i have deleted .htacess and saved permalink and it creates following .htaccess but still no luck.
# 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
Can some one help me solving the issue?
Please check if under Settings > General settings
Both the urls i.e Wordpress Address and Site Address are same.
Last time I had this issue when they were different. Changing them and reseting permalink fixed this issue for me.
I am not sure about this but, Put your htaccess file back and
RewriteBase /
replace with this
RewriteBase /public_html/
and
RewriteRule . /index.php [L]
replace with this
RewriteRule . /public_html/index.php [L]
May be it's the problem of URL rewriting.
Add the below code in .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
Once done then please make sure that the site URL and home URL for your site are set correctly. You can update the site URL and home URL from wp_options table, WordPress configuration file or from the WordPress administration panel.
Once done then please clear the cache of your system and try to access the website.
Let us know how you go.
Thanks to all of you for your valuable help and inputs. I struggled a lot on this issue and able to find the solution following these steps. Hope it will help some like me.
# Always use domain name in lower case.
In my case client domain is "SuzieSellsAZ.com" treat it as "suziesellsaz.com" all lower case.
Use Database Search and Replace Script in PHP to replace all occurence of previous domain.
ref:
https://interconnectit.com/products/search-and-replace-for-wordpress-databases/
Update the siteurl and home URL in database options table and all other occurrence in the database.
Once it done or database update then you should import to any server and it will works fine.
Sometime site post or page URL does not work then go to setting > permalinks and save it. Site post and page URL will work fine.
i have been writing .htaccess for the site http://hoteldevserver.com/~hamislan/ when i can the permalink to /%postname%/ its shows the following error when try to view the page.
The requested URL /~hamislan/info/services-amenities/ was not found on
this server. Additionally, a 404 Not Found error was encountered while
trying to use an ErrorDocument to handle the request.
i have my .htaccess file as
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
i have my wordpress file directly in www
Tthis could be one of a few things.
First check that your htaccess is readable by apache. I'm assuming it is.
Then check that you have mod-rewrite enabled in apache.
Lastly, it could be this symlink issue. And to fix this, you can add this to the top of your htaccess file or your can enable it in your vhost directive (I'm just assuming you're using a vhost) Sorry I don't have an example of how to do it in the vhost off the top of my head.
Options +FollowSymlinks
Also each time set your permalinks to the default and then switch it to the permalink style you want.
EDIT
Additionally, the url location of your website is not at the base http://hoteldevserver.com/~hamislan/
So you may need to edit your rewrite rule for base url. It's call RewriteBase
Right now RewriteBase is / you may need to change that to /~hamislan/
We have a WP install in the root of our server and its running great.. but, we just installed another app in a subdomain. Now, I can view the index.php of that app but cannot do anything with it.. the htaccess rules in the root (from WP base install) are effecting the requests.
So, how to I eliminate the WP htaccess file from effecting the subdomain?
Here is the htaccess contents for the root (WP install):
<IfModule mod_rewrite.c>
RewriteEngine On
# BEGIN WordPress
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
# END WordPress
</IfModule>
And for the htaccess in the subdomain:
RewriteEngine on
RewriteCond $1 !^(index\.php|css|stylesheets|js|images|user_guide|favicon\.ico|robots\.txt)
RewriteRule ^(.*)$ /index.php/$1 [L]
I've search everywhere online and tried a couple samples I found.. nothing has worked.
Any help is greatly appreciated !
Thanks
UPDATE:
It seems that maybe Wordpress is not the culprit.. out of curiosity, I removed all lines in the WP .htaccess file.. and the app in the subdomain was still not working. Its rewrite rule must be wrong..
So, it is the second rewrite rule that is not working. If I type in /index.php?about then I can see the about page.. but it should display by going to: /about
WP is also the culprit (you have two problems).
I can fix the first .htaccess problem because WP is predictable. You want to put this before the BEGIN WordPress section:
RewriteRule ^subdir-name/.*$ - [PT]
That grabs any requests to your subdir and Passes it Through (PT) so that it is not hijacked by WordPress.
The problem in your second .htaccess is that it seems to be assuming it is still in the root directory. For this one, I can't be sure without seeing the layout of your app, but the / before index.php may well be wrong. Are you sure that the paths in the second file match the new layout of your files?
Um... should this work? For sub-directory "office" - cheers :-)
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^office/.*$ - [PT]
# BEGIN WordPress
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
# END WordPress
</IfModule>
Well I did a wordpress installation with the newer version now available at dere website..
I did my installation at a subdomain: foo.abc.com
the problem came with the permalink which do not work dere bec of the htaccess file.
Can any one suggest me how to do that, i need to have only the category/postname
Till now i am able to do foo.abc.com/index.php/category/postname - I don't want index.php in it.
I have used this htacess file:
# disable the rewrite engine
RewriteEngine on
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /blog/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /blog/index.php [L]
RewriteRule ^post/([0-9]+)?/?([0-9]+)?/?$ /index.php?p=$1&page=$2 [QSA]
</IfModule>
# END WordPress
Please correct me if possible.
I'm not totally sure I understand the problem, but I'll try and throw out a few solutions.
In the Wordpress back-end, under the General Settings Tab- have you set the "Blog address (URL)" and "WordPress address (URL)" to the correct domain? This may write the correct .htaccess setting for you.
If you are trying to do something fancier with the domain such as category.blog.com/post_id, perhaps take a look at the WP Subdomains plugin.