1

My pages (index.php and view-contract.php) were in the root directory before, but then I moved these pages to the "account" folder. Before the pages were moved my RewriteRule was working but now it's not. I tried some of the subfolders redirection rules but they didn't work.

Thanks in advance.

URL in account/index.php

<a href="view-contract/'.$row['contractSlug'].'">'.$row['contractName'].'</a>

.htaccess

Options -Indexes -MultiViews

RewriteEngine On

RewriteBase /dashboard/

RewriteCond %{REQUEST_FILENAME} !-d [NC]
RewriteCond %{REQUEST_FILENAME} !-f [NC]

RewriteRule ^view-contract/([\w-]+)/?$ view-contract.php?contractID=$1 [QSA,L,NC]
AKIN CAN
  • 61
  • 6
  • You are rewriting to `view-contract.php` – where is the `account` folder in that path …? – CBroe Aug 04 '21 at 14:03
  • I tried to put before view-contract.php (`account/view-contract.php`) but it didn't work. – AKIN CAN Aug 04 '21 at 14:08
  • probably you need to change `RewriteBase /dashboard/` to `RewriteBase /account/` if your aim is `/account/view-contract.php`. Also here is no rule for `index.php` at all. https://stackoverflow.com/questions/704102/how-does-rewritebase-work-in-htaccess – rzlvmp Aug 04 '21 at 14:08

1 Answers1

0

Sometimes changes made to the .htaccess file do not take effect until you clear the browser history. First, clear your browser history.

And again show the subdirectory/folder path in the RewritRule:

RewriteRule ^account/view-contract/([\w-]+)/?$ account/view-contract.php?contractID=$1 [QSA,L,NC]