0

Uploaded code on staging server. in localhost everything is working well but on staging I can login to admin pabel but can not see any page on frontend. When any page is accessed it says The requested URL /projectname/testpage was not found on this server..

PHP version on localhost is 5.4.3 while on staging is 5.3.3. mod_rewrite is enabled on both. .htacess for staging site is

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /projectname/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /projectname/index.php [L]
</IfModule>

# END WordPress

Its the same in localhost too. Also checked if mod_rewrite is enabled on staging using apache_get_modules() and its true.

On staging only admin panel is working and not frontend pages. Old URl's are already replaced and even if I create a new page it says not found.

projectname/?page_id=519 works but projectname/test/ does not

  • Have you changed/overrided home & site URL on the staging server? And is the .htaccess writable? Flush your permalinks on the server. The RewriteBase is most likely the issue. – TheDeadMedic Feb 19 '15 at 12:34
  • Home and Site URL are changed to stagin one. htaccess file permission is 644. How can I flush permalinks on server ? – Slimshadddyyy Feb 19 '15 at 12:37
  • Just load the Settings > Permalinks page in the admin. – TheDeadMedic Feb 19 '15 at 12:40
  • Not working. Page on frontend is accessed only if permalink setting is set to Default. Could be some apache rewrite missing config ? – Slimshadddyyy Feb 19 '15 at 12:44
  • Remove the <IfModule></IfModule> conditional tags - if your server throws a 500 mod_rewrite something's not right. What's the full URL to your staging server's WordPress installation? – TheDeadMedic Feb 19 '15 at 12:48
1

On the staging server, in your wp-config.php

define( 'WP_SITEURL', 'http://SERVER_IP/projectname' );
define( 'WP_HOME',    WP_SITEURL                     );

Then:

  • Place an empty .htaccess in /projectname
  • Load http://SERVER_IP/projectname/wp-admin/options-permalink.php
  • Check .htaccess - have rewrite rules been added?
  • Did everything you said above and .htaccess code generated is ` # BEGIN WordPress <IfModule mod_rewrite.c> RewriteEngine On RewriteBase /projectname/ RewriteRule ^index\.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /projectname/index.php [L] </IfModule> # END WordPress ` – Slimshadddyyy Feb 19 '15 at 12:55
  • anytihng related to CentOS ? – Slimshadddyyy Feb 19 '15 at 14:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.