# Edit Custom Page URL

This guide will help you set up custom URLs for pages created in Edwiser RemUI Page Builder. You don’t need to be a tech expert—just follow these steps carefully.

***

### Step 1: Identify Your Server (Nginx or Apache)

Before making changes, you need to know whether your Moodle site is running on an **Nginx** or **Apache** server.

#### How to Check Your Server Type

1. **For Moodle Admins:**
   * Go to **Site administration** > **Server** > **PHP info**.
   * Look for the **Server API** section.
   * If it says **Apache**, you're using an Apache server.
   * If it mentions **FPM/FastCGI**, you're likely using Nginx.
2. **Using the Command Line (For Those with Server Access):**
   * Connect to your server using SSH.
   * Run this command:

     ```
     apache2 -v
     ```

     * If you see a version number, you have **Apache**.
     * If not, try:

     ```
     nginx -v
     ```

     * If this shows a version number, you have **Nginx**.

Once you’ve identified your server, proceed to the correct section below.

***

### Step 2: Configure Custom URLs

#### **For Nginx Users**

**Setting Up a Custom URL for a Single Page**

1. Open your Nginx configuration file. It’s usually located at:

   ```
   /etc/nginx/sites-available/default
   ```
2. Add this code inside the **server block**:

   ```
   location = /custom-page {
       rewrite ^/custom-page$ /local/edwiserpagebuilder/page.php?id=5 last;
   }
   ```
3. Save the file and restart Nginx:

   ```
   sudo systemctl restart nginx
   ```

Now, your page will be accessible at:

```
http://example.moodle.com/custom-page
```

**Setting Up Multiple Pages Dynamically**

For multiple pages, use this instead:

```
location ~ ^/custom-page/(\d+)$ {
    rewrite ^/custom-page/(\d+)$ /local/edwiserpagebuilder/page.php?id=$1 last;
}
```

Now, you can access pages dynamically like:

```
http://example.moodle.com/custom-page/5
```

**Alternative URL Format**

If you prefer:

```
http://example.moodle.com/5/custom-page
```

Use this:

```
location ~ ^/(\d+)/custom-page$ {
    rewrite ^/(\d+)/custom-page$ /local/edwiserpagebuilder/page.php?id=$1 last;
}
```

***

#### **For Apache Users**

**Enable URL Rewriting**

1. Enable the **mod\_rewrite** module by running:

   ```
   sudo a2enmod rewrite
   sudo systemctl restart apache2
   ```
2. Make sure your **.htaccess** file is inside:

   ```
   /var/www/html/moodle/.htaccess
   ```

**Setting Up a Custom URL for a Single Page**

1. Open your `.htaccess` file.
2. Add this rule:

   ```
   RewriteEngine On
   RewriteRule ^custom-page$ /local/edwiserpagebuilder/page.php?id=5 [L]
   ```
3. Restart Apache:

   ```
   sudo systemctl restart apache2
   ```

Now, your page is available at:

```
http://example.moodle.com/custom-page
```

**Setting Up Multiple Pages Dynamically**

For multiple pages, use:

```
RewriteEngine On
RewriteRule ^custom-page/([0-9]+)$ /local/edwiserpagebuilder/page.php?id=$1 [L]
```

Now, your pages will be accessible at:

```
http://example.moodle.com/custom-page/5
```

**Alternative URL Format**

For URLs like:

```
http://example.moodle.com/5/custom-page
```

Use:

```
RewriteEngine On
RewriteRule ^([0-9]+)/custom-page$ /local/edwiserpagebuilder/page.php?id=$1 [L]
```

**Ensure .htaccess Works**

Check your **Apache configuration file** (`/etc/apache2/apache2.conf`) and make sure it includes:

```
<Directory /var/www/html>
    AllowOverride All
</Directory>
```

Then restart Apache:

```
sudo systemctl restart apache2
```

***

### **Final Step: Restart Your Server**

After making changes, restart your server to apply them:

* **For Nginx:**

  ```
  sudo systemctl restart nginx
  ```
* **For Apache:**

  ```
  sudo systemctl restart apache2
  ```

***

### **That's It! 🎉**

Now, your custom pages should be working with clean URLs! 🚀


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://remui-docs.edwiser.org/custom-page-creation/edit-custom-page-url.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
