WordPress on Localhost with .htaccess - wordpress

I have installed WordPress (latest) on a local server which is running on UniServer.
The installation finished OK and I was able to navigate around the admin area and added a couple of posts.
Looking from the front end, everything worked.
I then changed the Permalink setting to 'Post name' and, when I saved it I revceived an error "Forbidden - You don't have permission to access /wp-admin/options-permalink.php on this server."
On checking I found that if I deleted the .htaccess file I regained access and could reset the Permlink setting to 'Plain'.
Changing to anything but 'Plain' causes a .htaccess file to be created and no access.
The Apache error log shows the following: -
"[Wed Mar 21 12:35:04.297002 2018] [rewrite:error] [pid 14192:tid 1908] [client ::1:52537] AH00670: Options FollowSymLinks and SymLinksIfOwnerMatch are both off, so the RewriteRule directive is also forbidden due to its similar ability to circumvent directory restrictions : D:/WEBS/js/wp-admin/options-permalink.php, referer: http://localhost/wp-admin/options-permalink.php"
I have used Google to search this message and have been round in circles with changes to the .htaccess file and also httpd.conf to no avail.
The .htaccess file that is created is as follows: -
# 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
I have followed what is posted here: [https://codex.wordpress.org/Using_Permalinks]
Any help would be much appreciated...

OK, the solution appears to be that SymLinks needs to be enabled.
So, I added the following to .htaccess
Options +FollowSymLinks
What I did not notice was that, when I changed the Permalinks option in WordPress, the code above was stripped out.
So after further searching on Google and testing with the httpd.conf file I found that by adding the following line to DocumentRoot works
Options Indexes FollowSymLinks SymLinksIfOwnerMatch
I am not convinced that I need all of the options and, time permitting, with try to understand the consequences of each one and whether they are required.
However, for now, I can access the WordPress site locally again with PermaLinks set to 'Post name'.

Related

Wordpress permalink structure change issue

I have seen some other posts on SO about this issue, however none of the suggested solutions did work for me, so I repost.
After changing my permalink structure to /%postname%/, none of the links is working. I get the following 404:
Not Found
The requested URL /my-post-name/ was not found on this server.
Apache/2.2.20 (Ubuntu) Server at mysite.com Port 80
When I get back to the default permalink structure it starts to work again, but I want to have /%postname%/ structure anyways.
My .htaccess file's chmod is 777.
After updating my permalink structure to /%postname%/, the .htaccess file generated by Wordpress is the following:
# 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
Any thoughts?
Edit:
I tried to change permalink structure to the following:
/index.php/%postname%/
and it happily worked. However, the problem is now, not surprisingly, the links are in the following form:
www.mysite.com/index.php/my-page.com
My question is how can I remove index.php from my links. When I remove it from the permalink structure (i.e., /%postname%/), my links no longer work.
PS: Instead of using blog entries I use only pages in my site. If it is necessary my site is: mll.sehir.edu.tr.
There are many ways how you can fix this issue, if you know the root of the issue.
Problem 1
Firstly, it may be a problem with your apache not having the mod_rewrite.c module installed or enabled.
For this reason, you would have to enable it as follows
Open up your console and type into it, this:
sudo a2enmod rewrite
Restart your apache server.
service apache2 restart
Problem 2
You may also, in addition to the above, if it does not work, have to change the override rule from the apache conf file (either apache2.conf, http.conf , or 000-default file).
Locate Directory /var/www/
Change the Override None to Override All
Problem 3
If you get an error stating rewrite module is not found, then probably your userdir module is not enabled. For this reason you need to enable it.
Type this into the console:
sudo a2enmod userdir
Then try enabling the rewrite module if still not enabled (as mentioned above).
To read further on this, you can visit this site: http://seventhsoulmountain.blogspot.com/2014/02/wordpress-permalink-ubuntu-problem-solutions.html
Sounds like a problem with symlinks on your server. Try this in your .htaccess and also please change it to 644 after making the change:
Options +FollowSymlinks
RewriteEngine on
# 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
I had the same problem but i am using other url structure /%category%/%postname%/
The problems with de 404 error is because even if you set a certain structure, wordpress is always trying to create the urls with the word "category" on the url.
Try to type your urls like this: yoursite.com/category/postname, if you are not getting any error now is because we are close to resolving the error. Now try to install this wordpress plugin http://wordpress.org/extend/plugins/no-category-base-wpml/ to remove the "category" base from urls
Let me know about your progress
Replace and try your .htaccess with this:
Options +FollowSymlinks
RewriteEngine On
RewriteCond %{HTTP_HOST} ^hostname.com$
RewriteRule ^(.*)$ http://www.hostname.com/$1 [R=permanent,L]
I got this issue whenever i try to enable my site's permalink to mod_rewrite: "Pretty Permalinks". My site is one instance on AWS EC2.
404 Errors
Page Not Found
The requested URL .... was not found on this server.
Apache/2.4.7 (Ubuntu) Server at mydomain.com Port 80
I tried all above methods, but not being fixed.
At last, I checked the /etc/apache2/sites-available/wordpress.conf, I found I used public IP address assigned to each instance by AWS. Once I change it to the current mydomain.com, it's working.
Sometimes, wordpress.conf would be locked by httpd (web serser), we need to stop and start it after edit. We also need to use: sudo service apache2 stop/start so as wordpress.conf could be reload again.
Hope my experience could help others.

Wordpress 3.4.2 website internal server error 500 but admin panel is working fine

I have just published my site from localhost to online server and there I am experiencing with an internal server error 500 when I hit my website URL http://www.playinkstudio.com
but the admin panel http://www.playinkstudio.com/wp-admin is just working fine.
I have read articles over the internet and checked the .htaccess file which is not there in the root directory.
I have changed the theme to default but nothing happened.
Then I had deactivated the plugins but does not worked.
Copied the refresh files but useless.
Any Idea ?
Did you updated the site and home url's??
There are two places you need to update your WordPress URL when you plan on changing it. They are both located under the General > Settings SubPanel. Update the “WordPress address (URL)” and “Blog address (URL)” values to the new URL for your website.
check the htaccess whether it has correct path
if you have just copy that htaccess there need to be correct the path
Update
may this could help you
[link]http://wordpress.org/support/topic/500-internal-server-error-24[/link]
if htaccess is not there create a htaccess file using a text editer having the following code and upload it into wordpress directory.
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

Wordpress is cut off when linking to pages using /index.php/page-name

I have posted this question on bitnami answers as well but I am refining it here. The relevant link is:
I am running the bitnami wordpress stack on my Kubuntu Linux machine. I am linking to pages internal to my site in my content with absolute links like this /index.php/page-name and my server is running at http://127.0.1.1/wordpress/. The appropriate relative links work correctly but the absolute links do not.
The behaviour I am getting with the absolute links is that the /wordpress/ path component is truncated when using /index.php/page-name and points to http://127.0.1.1/index.php/page-name instead of http://127.0.1.1/wordpress/index.php/page-name.
I am using the Post name permalink structure and my .htaccess file also has the following rewrite rules:
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /wordpress/
RewriteRule ^index\\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /wordpress/index.php [L]
</IfModule>
# END WordPress
Every time I click the link I get a 404 error with this message in the apache error log:
script '/home/nandu/wordpress-3.3.1-1/apache2/htdocs/index.php' not found or unable to stat
I am not sure why the wordpress part of the URL is getting cut off when my settings in the admin area show both the site url and address url pointing to http://127.0.1.1/wordpress.
Furthermore according to the wordpress codex /index.php/ should point to the site root.
I am at my wits end as far as this problem is concerned. Kindly do let me know if you require any more information.
Thanks in advance.
nav
I'm not sure why you're trying to write your links via index.php. You should create links that match the permalinks that WordPress itself would produce. So, instead of /index.php/page-name, you would put /wordpress/page-name.
I have succeeded in getting my bitnami wordpress stack to run wordpress on the root url http://127.0.1.1/ so that the links in my content will work identically to my production system.
Here are the steps I followed modify to suit your needs:
Edit the following lines in /<INSTALL_DIR>/apache2/conf/httpd.conf
from:
DocumentRoot "/<INSTALL_DIR>/apache2/htdocs"
to
DocumentRoot "/<INSTALL_DIR>/apps/wordpress/htdocs"
In the same file, also change the following directive
from
<Directory "/<INSTALL_DIR>/apache2/htdocs">
to
<Directory "/<INSTALL_DIR>/apps/wordpress/htdocs">
Go to /<INSTALL_DIR>/apps/wordpress/conf/wordpress.conf and comment out the following lines by prepending a #:
Alias /wordpress/ "/<INSTALL_DIR>/apps/wordpress/htdocs/"
Alias /wordpress "/<INSTALL_DIR>/apps/wordpress/htdocs"
In the same file change
from:
RewriteBase /wordpress/
to
RewriteBase /
In the same file, uncomment the following lines by removing the #:
#RewriteEngine On
#RewriteRule ^/$ /wordpress/ [PT]
Restart the bitnami apache server:
/<INSTALL_DIR>/ctlscript restart
Edit the following lines in /<INSTALL_DIR>/apps/wordpress/htdocs/.htaccess
from:
RewriteBase /wordpress/
to
RewriteBase /
and
RewriteRule . /wordpress/index.php [L]
to
RewriteRule . /index.php [L]
Login to PHPMyAdmin at http://127.0.1.1/phpmyadmin and go to the wp_options table change siteurl value
from:
http://127.0.1.1/wordpress
to
http://127.0.1.1
After this rename the index.html file in the /<INSTALL_DIR>/apache2/htdocs/ directory to old-index.html
Restart the bitnami apache server:
/<INSTALL_DIR>/ctlscript restart
Navigating to http://127.0.1.1/ should show the homepage of the site. There is some documentation on the bitnami wordpress docs about what needs to be done to change the root url but they seemed incomplete in terms of what I had to do to accomplish this.
Hope that helps someone. :-)
nav

Wordpress: move site online 500 Internal error

Hi Hi have a working website on localhost that I want to move online.
I'm using WP 3.2.1 and I exported the DB from my localhost.
After that I just opened the .sql file with a text editor and replaced all of the 'http://localhost/mysite' with 'http://mynewdomain.com'.
After that I edited the wp-config.php file for the new destination DB online,and so I uploaded everything online.
I can see the index.php page correctly (apart from espanol,chinese etc characters broken) and few other secitons but if I try to reach the wp-admin section ..and whenever i try to browse to any another site's section I get the following error:
Warning: Cannot modify header information - headers already sent by (output started at /web/htdocs/www.***.it/home/wp-content/themes/ottaviano/shortcodes.php:55) in /web/htdocs/www.***.it/home/wp-includes/pluggable.php on line 934
My htaccess
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
SOLVED: I had to enable the output buffering and everything is fine again!
Try to temporary remove your .htaccess file and see if you can access your admin again.
Restore you .htaccess and try adding:
define('WP_DEBUG', true);
into the top of your wp-config.php if this doesn't work you also try adding the code below to the bottom of the wp-config.php
ini_set('display_errors',1);
error_reporting(E_ALL);
and hopefully you get some error messages telling you what is going on.
Just had a similar problem when moving a Wordpress site from one domain to the other (Error 500 - page not found).
Apparently a whitespace character found its way before the beginning <?php declaration in a template file.
You can trace the error by inserting a exit("wtf")? in index.php and "WTF-ing" your way to the affected file.
In my case, the reason was a move from Apple-based OS to Windows with differences in CR/LF handling.

Wordpress installed in root folder, subdomain now not working, GoDaddy host

please forgive me for being a complete beginner at this, I'd rather not have to try to deal with this myself but as GoDaddy support have not replied after 2 days I'm going to have to. I think my problem is the same as the one above, but I'm not 100% sure, so I'm reposting it, I'm not really confident enough to attempt to try the fixes I've seen here so I need someone to give me baby instructions?
Our original website (www.mwpics.com.au) was built in Dreamweaver etc, recently we created a new website in Wordpress, in a subdomain, then migrated it over to the root folder where it is now operating fine. I also moved the files for the old website into another directory which I called 'old', so they're all still there.
The problem is that I have a subdomain set up - which is still showing as set up in the control panel on godaddy the url is www.mwpics.com.au/clients and it is at www.clients.mwpics.com.au. This directory contains loads of other directories, each of which is password protected by .htaccess files and which our clients access directly (not through the site) to download their finished work. The test one and the one for random clients is www.mwpics.com.au/clients/temp - username and password both temp (the usernames are all the same as the directory names).
Since the WP install to the root directory the /clients extension no longer works (it should bring up an information page which is an .html index page in the directory) and the /clients/name extensions no longer works - it goes back to the wp site with a 'not found' error message. Strangely it does bring up the box for the username and password, but when you enter it it just goes back to the 'not found' message.
Someone told me it was the .htaccess file - so as an experiment, I renamed the .htaccess file in the root directory and then copied the .htaccess file from the old root files into the root directory, eureka! It worked - and also the WP site opened to the home page... but bummer - the /pages in the WP site now no longer worked! But at least I know the source of the problem.
So I switched it back and this is the status quo - I have no idea how to fix this, and with everyone back at work tomorrow, clients are going to want to start downloading their stuff...
Can anyone help me? I'm starting to panic a bit
you only have to exclude the clients subfolder in your wordpress .htaccess - see .htaccess & Wordpress: Exclude folder from RewriteRule for a detailed description
this should work:
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_URI} !^/clients.*
RewriteCond %{SERVER_NAME} !clients\.yourdomain\.com
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
short: it simply skips the wordpress rewrite rule if the reqest uri starts with /clients or the domain name is clients.yourdomain.com
be aware though, that as soon as you update your wordpress permalink settings, this rule will be overwritten by wordpress ...
Try adding the following at the top of your root directory's .htaccess file, before the WP code block:
<IfModule mod_rewrite.c>
# fix rewrite for GoDaddy
Options -Multiviews
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} clients.mwpics.com.au$ [NC,OR] # ignore subdomain
RewriteCond %{REQUEST_FILENAME} -d [NC] # ignore directories
RewriteRule .* - [L]
</IfModule>

Resources