Accessing folder inside WordPress installed website cpanel - wordpress

I have website in which there is word press installed,now i just crated ftp account to certain directory say www.certainwebsite.com/username
now when i goto this link,it keeps me tracked back to www.certainwebsite.com isntead of goign to this link of www.certainwebsite.com/username .
Any suggestions?

i think that you need to change http:// to ftp://

If you are only serving static files out of that folder, try dropping an .htaccess file in the subdirectory that turns off the rewrite engine.
Create a text file called .htaccess in that directory with something like this in it.
<IfModule mod_rewrite.c>
RewriteEngine Off
</IfModule>

Related

All my WordPress pages are redirecting to Xampp's homepage

I have a local Xampp stack setup for my WordPress site. It was first installed on another web server(clients web server) and im doing work on it locally. So I downloaded all the files and database to my local Xampp server. So here is what I did to run it locally to begin with:
first I changed the URL in the database table: wp_options for the siteurl.
Then I added these two lines of code to the end of my wp-config:
define('WP_HOME','http://localhost/wpsite');
define('WP_SITEURL','http://localhost/wpsite');
Those are the only changes I made to run it locally. Also, in the root of the WordPress site folder, there is this .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
I have tried all options:
commenting out all combinations of the wp-config.php file's define lines.
deleting the .htaccess file with combinations of all the define lines in wp-config.php file.
Also the homepage and admin urls are fine. It's the permalinks that aren't working. For instance http://localhost/wp_site/about redirects to Xampp's homepage and if the .htaccess file is deleted it gives Xampp's default 404 error page.
I resolved this issue by navigating to Settings > Permalinks in the WP admin, scrolling to the bottom, and clicking "Save Changes", an idea I got from this WP forum page, to regenerate the permalinks.
For the whole transfer process, I followed these instructions exactly and then at the very end resolved the issue making the permalinks change I mentioned above.
Your site is behaving proper as per changes made by you. You just changed the base URL and hence it is not working for other pages which is obvious thing.
See, changing just site base URL is not enough while migrating a site from one set up to another, each of your old URL should be replaced by its respective new URL.
Tweak in .htaccess may help you temporarily but that is something which will just keep on redirecting your pages. Once you are done with development on your local system, you might be needing to move the changes back to live server. So, making permanent changes in DB will be more proper than making changes in .htaccess.
I would suggest to undo what have you done so far or simply start making a new set up as per following guidelines -
Copy your WordPress files to your localhost e.g. in 'wpsite' folder (without .htaccess file).
Export DB from your live set up (can use PhpMyAdmin)
Import the DB in your localhost set up (can be done using PhpMyAdmin or
MySQL dump).
Replace all the URLs
Can use a tool like this https://interconnectit.com/products/search-and-replace-for-wordpress-databases/
You can put the search and replace PHP file in your WP root directory and run through the browser. Follow the steps and all the URLs will be replaced.
Login to your new set up.
Recreate the .htaccess.
Done.
OR
You can also make use of this plugin to do activities like above in more automatic way https://wordpress.org/plugins/wp-clone-by-wp-academy/
follow These steps
1. Delete htaccess file
2. Delete cache folder if cache folder exist in wp-content folder
3. Do permission of wp-content folder writable.
It could be because the URLs are being cached. Now that you're hosted on localhost, the old URLs are invalid. Login to wp-admin and pick "Delete Cache" option if you're using WP Super Cache.
The other Wordpress solutions/suggestions on this page did not even touch all the possible URLs related to the site in the database. A quick
`SELECT * FROM wp_options WHERE option_value = 'home url for your site'`
found two records where your site's url and home url are set. All I had to do what to change both of those fields to my local setup URLs - that was it.

rewrite rule for files with pattern to go to subdirectory

I have files with this pattern :
(a[0-9]+\.htm)$
Considering file names a1180717200.htm or a1245862800.htm : normally they would be in root for the domain I am working with. Instead they have been moved to a new directory /archives so the files are now in :
thedomainiamworkingwith.com/archives/a1245862800.htm
I have tried a few things but I have no success. The root is occupied by a working wordpress site, with its normal .htaccess file set up. So I need to know what the redirect or RewriteRule would be, as well as how to put it in the .htaccess file without messing up the current wp install.
Are you trying to redirect your pages of this pattern to archives directory?
You can try something like this
RewriteRule ^(a[0-9]+.htm)$ thedomainiamworkingwith.com/archives/$1 [R=301,L]

URL rewriting For WordPress - Integrating Non Wordpress site with wordpress

We are unable to change the url rewriting to integrate an exsiting directory site into my wordpress site.
WordPress is fixing everything to their url pattern.
How can I help my programmer? Can someone give an advise?
More details would be useful, but in all likelihood, add a do nothing and stop rule for your folder before the WP rules:
RewriteEngine On
RewriteBase /
RewriteRule ^folder - [L]
We integrate WordPress with Ruby-on-Rails on ICanLocalize.
This is done in the Apache config file. Use the Apache Alias command to indicate that a path comes from a different physical directory.
Then, the URLs that match that path will never go to WordPress. They will be served from the other physical directory, where you can place anything.
If you need to take a subdirectory out of the url-rewriting from wordpress, put an additional .htaccess file into that directory and switch the Rewrite-Engine off:
RewriteEngine Off
That directive overrides any settings of the wordpress .htaccess for that directory and it's subdirectories.
You find the longer version of my answer in a related question on wordpress answers with a slightly different .htaccess code.

WordPress is giving me 404 page not found for all pages except the homepage

All of a sudden I go to my WordPress website and all the pages give me a 404 page not found page. I'm assuming the problem lies with the permalink structure, which I could swear I did not touch. The permalink setting is on "month and name."
I've researched similar instances of this problem online and a lot of it has to do with the .htaccess file? I tried finding, but I can't. Perhaps it got deleted somehow? Where is it supposed to be located.
Any suggestions will be helpful
and of course I can see hidden files.
.htaccess is a hidden file, so you must set all files as visible in your ftp.
I suggest you return your permalink structure to default ( ?p=ID ) so you ensure that .htaccess is the problem.
After that, you could simply set "month and name" structure again, and see if it works.
PS: Have you upgraded to 3.1? I've seen some people with plugin issues in this case.
Basically the .htaccess file should exists and the httpd.conf should be correct.
In my case, I changed the file /etc/apache2/apache2.conf in section:
<Directory "/var/www/html">
Line changed is:
AllowOverride None
to
AllowOverride All
And restart the web server with
systemctl restart apache2
Fixing that problem is very simple if you was using permalinks other than the default such as Day and name, Month and name, Numeric, Post name or Custom Structure, you only need to
Login to your admin area: Settings > Permalinks which should be : http://yoursite.com/wp-admin/options-permalink.php
Choose Default permalink setting, then save changes
Then you can return it again to your other previous permalink choice or keep it as default as yo wish
Note that this problem can happen when you move your site from a domain or location to another one.
If the default behavior (example.com/?p=42) is working, you should:
Change to your preferred permalink style: Admin: Settings > Permalinks, and click Save. Sometime it fixes the issue. If it didn't:
Verify that the file /path/to/wordpress/.htaccess has been changed and now includes the line RewriteEngine On. If it doesn't include the line, it's a Wordpress permissions issue.
Verify that the 'rewrite' module is loaded: create a PHP file with
<?php
phpinfo()
?>
in it, open it in the browser and search for mod_rewrite. It should be in the 'Loaded Modules' section.
If it's not, enable it - Look at your apache default index.html file for details - in Ubuntu, you do it with the helper a2enmod.
Verify that apache server is looking at the .htaccess file. open httpd.conf - or it's Ubuntu's alternative, /etc/apache2/apache2.conf. In it, You should have something like
<Directory /path/to/wordpress>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
After making these changes, don't forget to restart your apache server. sudo service apache2 restart
IF all this dont work, your .htaccess is correct, and permalinks trick didnt work, you may have not enabled your apache2 rewite mod.
I ran this and my issue was solved:
sudo a2enmod rewrite
Within the WordPress admin interface do the following:
Go to admin setting
Click on permalink and select post name in radio button.
Scroll down and you will see .htaccess code here like.
<IfModule mod_rewrite.c>
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /wordpress/index.php [L]
</IfModule>
Copy the code and paste in the .htaccess file.
This error is causing due to disabled of rewrite mod in apache httpd.conf document ,just uncomment it and enjoy the seo friendly permalinks
Check that the directory on .htaccess are the correct
Check the fields "siteurl" and "home" are the correct
We had the same problem and solved it by checking the error.log of our virtual host. We found the following message:
AH00670: Options FollowSymLinks and SymLinksIfOwnerMatch are both off,
so the RewriteRule directive is also forbidden due to its similar
ability to circumvent directory restrictions :
/srv/www/htdocs/wp-intranet/
The solution was to set Options All and AllowOverride All in our virtual host config.
If you have FTP access to your account:
First, login to your wp-admin and go to Settings > Permalinks
You should see something at the bottom that says:
"If your .htaccess file were writable, we could do this automatically, but it isn’t so these are the mod_rewrite rules you should have in your .htaccess file. Click in the field and press CTRL + a to select all."
If this is true do the following:
Go into preferences for your FTP client and make sure hidden files are displayed (varies depending on your FTP client) - If you don't do this you won't be able to find your htaccess file
Go to the folder that your wp-admin, wp-content, wp-includes directories are located. Check for .htaccess file. If it exists skip to step 4
If it does not exist, create a new blank file in your FTP program called .htaccess
Change the CHMOD for your .htaccess file to 666 (your preference on how you want to do this)
Go back to your Permalinks page and edit the link structure you want. Problem should be solved!
Make sure to change the chmod of the htaccess file back to 644 after you are done.
Just had the same problem and it seemed to fix it instantly! Good luck!
Most of the time this issue is fixed by simply visiting the Settings -> Permalink page in the WordPress admin and click Save (as several other answers already pointed out). When this page is accessed, WordPress rewrites the directives in the .htaccess file which magically fixes the issue. The issue often happens after moving a site (the site breaks because the .htaccess gets left behind or the settings need to be updated).
If WordPress doesn't have the right permissions to write the .htaccess file, a notice will appear at the top of the page and further instructions at the bottom when the settings are saved. In this case you need to edit the .htaccess file yourself or, better, to fix the permissions on that file. The file is at the root of the WordPress installation. cd into the directory and sudo chmod 644 .htaccess. You might also want to check if the file belongs to the right group and change that is needed with chown. Ask your hosting provider if you don't know how to do that.
If you are on shared hosting that's probably all you can do. If you still have the issue you might want to talk to you hosting provider's support. Otherwise, make sure the use of .htaccess files is enabled on the server, as #georgeos already suggested. Note that httpd.conf is not always used (Ubuntu indicates it is deprecated but the official Apache docs still says it is often the main configuration file). /etc/httpd/conf/httpd.conf and /etc/apache2/apache2.conf seem to be the most common places for this file. Find the block for the public folder, usually <Directory /var/www/> and make sure that the AllowOverride directive is set to All. If it is set to None, your .htaccess file is simply ignored by the server.
I installed mod_rewrite to fix the issue. Below link provides an installation guide:-
http://www.iasptk.com/enable-apache-mod_rewrite-ubuntu-14-04-lts/
You may have .htaccess disallowed in webhost settings.
Setting to default permalinks would work in that case.
Before trying to do any permalink or server config changes, please check you .htaccess file. This mostly is a corrupt or blank .htaccess file issue. Reset the htaccess file to the default
# 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
Case 1:- Let us think if migrate site from one hosting to another hosting if see this kind of issue.
Solution:- Simply go to old server copy .htaccess file code, then past in new server .htaccess file. 99% it i will works.
If your WordPress installation is in a subfolder (ex. https://www.example.com/subfolder) change this line in your WordPress .htaccess
RewriteRule . /index.php [L]
to
RewriteRule . /subfolder/index.php [L]
By doing so, you are telling the server to look for WordPress index.php in the WordPress folder (ex. https://www.example.com/subfolder) rather than in the public folder (ex. https://www.example.com).
after 2 long days,
the solution was to add options +FollowSymLinks to the top of my .htaccess file.
I have the same problem and so I remove the Apache and make it again and the problem was solved.
Just Navigate to Settings->Permalink in your dashboard and then Save Changes button in the last.\
I just changed the permalink to 'month and day'of all the posts by ging to setting>permalink.
Now all posts are open and working fine.
Again, I renamed to all posts to its actual permalink. Its again working fine.
This method worked for me :-)
For nginx users
Use the following in your conf file for your site (usually /etc/nginx/sites-available/example.com)
location / {
try_files $uri $uri/ /index.php?q=$uri&$args;
}
This hands off all permalink requests to index.php with a URI string and supplied arguments. Do a systemctl reload nginx to see the changes and your non-homepage links should load.
Go to your WordPress Dashboard, scroll down to settings, select Permalink,
in custom settings that appear, go to custom structure and replace the text in the text field with
/index.php/%year%/%monthnum%/%day%/%postname%/
and then save changes
Wanted to share my two cents. Recently came accross that very same issue installing WordPress 5.9. Year 2021.
Configuration:
Platform MAC, Software XAMPP, WordPress 5.9
None of the previous answer did it for me.
The issue was due to the fact that files permissions accross the XAMPP folder were set to "Read only".
Locate the XAMPP folder. (Usually in the Applications folder).
Right click XAMPP folder.
Get info.
Bottom right unlock button → Follow instructions.
Sharing and permissions → Everyone → Read & Write.
Bottom left three dots button → Apply to enclosed items.
This scenario can also be caused by a database version that's out of sync with the WP files installed on server. Nothing else listed here worked for me; I solved it with a manual WP update.
I had this issue not so long ago. I had reset my permalink to default or just saved it, updated themes/core to (4.7.4)/plugins, deactivated all plugins, switched to default theme, optimized database, .htaccess is already default, checked file permissions, mod_rewrite is on.
So far nothing works, what works are the posts, new page, the /contact page EXCEPT for old pages.
Basically, the pages/URLs that aren't working are:
/breeding
/training
/training/*
/breeding/*
Ultimate, I found these files in the root folder:
/breeding.php and /training.php
I renamed both files and the pages above worked.

WordPress pages outside install directory

I have WordPress installed in a subdirectory and I'd like one WordPress page to appear as if it's on the root.
Eg.
/wordpress/mypage
To appear as:
/mypage
Assuming you're on Apache, and you've got permalinks already working, you can use an .htaccess file in your document root to rewrite yoursite.com/wordpress/mypage to yoursite.com/mypage.
If you don't already have a .htaccess file in your document root, create one and put this in:
RewriteEngine on
RewriteRule ^mypage$ wordpress/mypage
I'm no .htaccess expert, but that should do the trick.

Resources