PermaLinks conflict
5 posts by 4 authors in: Forums > CMS Builder
Last Post: 3 hours ago (RSS)
By moh3 - February 3
Hello i'am using perma links and the admin folder is rewritten with the dispatcher ,any idea what the issue is? i'm moved the dispatcher to the roor directory as im protecting the admin folder with password
By Dave - February 3
Hi moh3,
So in .htaccess we have something like this that checks to the see if the URL or permalink exists as a file or directory. If it doesn't it passes the request to the dispatcher:
### Pass URL to permalinks dispatcher (do this last after any other redirects)
RewriteRule ^permalinks_dispatcher\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /cmsb/plugins/permalinks/permalinks_dispatcher.php [L]
But if you're password protecting your admin folder with .htaccess and .htpasswd, that can interfere with the directory detection and redirect.
You can try adding a condition to skip your admin folder when processing permalinks. Something like this:
### Pass URL to permalinks dispatcher (do this last after any other redirects)
RewriteRule ^permalinks_dispatcher\.php$ - [L]
RewriteCond %{REQUEST_URI} !^/cmsb/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /cmsb/plugins/permalinks/permalinks_dispatcher.php [L]
Let me know if that works for you!
interactivetools.com
By moh3 - Sunday at 3:08am
hello thanks for your feedback, i have a rule in my .hta access to remove slash from end of any URL to avoid duplicate issues for SEO but it seems it had broken the rewrite rules
i tried alot of things , but in the end i defined the admin folder as perma link and it worked, the password is working as well
<IfModule mod_rewrite.c>
RewriteEngine On
##########################################
# CANONICAL DOMAIN (www → non-www)
##########################################
RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
RewriteRule ^ https://%1%{REQUEST_URI} [R=301,L]
##########################################
# REMOVE TRAILING SLASH (FILES & DIRS SAFE)
##########################################
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} .+/$
RewriteRule ^(.+)/$ /$1 [R=301,L]
##########################################
# FRONT CONTROLLER DISPATCH
##########################################
RewriteRule ^permalinks_dispatcher\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /permalinks_dispatcher.php [L]
</IfModule>
By kitsguru - 3 hours ago
personally I set my htaccess rules to enforce the trailing slash, much cleaner in the long run as that is what the permalinks expects, still solves the seo noise
yaadev.com
By KennyH - 3 hours ago
Same here, Jeff. I got tired of Google fighting me with canonical issues so everything gets a slash at the end
Kenny H