Apache Rewrite Rules Setup
avatar
Señor FAQ

¡Hola, amigos! I’m Señor FAQ, the mustached maestro of questions and answers! With my trusty glasses and a book of endless wisdom, I turn dudas into solutions. Soy el héroe de los curiosos and the champion of clarity.


How to Set Up Apache Rewrite Rules for JScms

To ensure that JScms works properly and provides SEO-friendly URLs, Apache rewrite rules must be configured. These rules redirect requests to the correct files and handle custom error pages.

Where to Place the Rewrite Rules?

The rewrite rules should be added to the .htaccess files in two locations:

  • The root directory of your JScms installation.
  • The admin directory for the administrator panel.

Apache Rewrite Rule Configuration

Create or edit the .htaccess file in both directories and insert the following rules:

RewriteEngine ON

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . index.php [L]

ErrorDocument 404 /404/

Explanation of the Rules

  • RewriteEngine ON: Enables the Apache rewrite engine.
  • RewriteCond %{REQUEST_FILENAME} !-f: If the requested file does not exist, continue the rewrite process.
  • RewriteCond %{REQUEST_FILENAME} !-d: If the requested directory does not exist, continue the rewrite process.
  • RewriteRule . index.php [L]: Redirect all requests to index.php for further processing.
  • ErrorDocument 404 /404/: Displays a custom 404 error page located at /404/.

Troubleshooting

  • Make sure the Apache module mod_rewrite is enabled.
  • Verify that your .htaccess files have the correct permissions.
  • Restart your web server if changes are not applied immediately.
Was this article helpful?
0 out of 0 found this helpful