Forum

Thread tagged as: Question, Problem

.htaccess clean urls do not let me go into Perch panel

Hi, I am trying to use clean urls and when I try to enter mysite.com/perch it just change the url to mysite.com/perch/core/apps/content/?s=core/apps/content

ErrorDocument 404 /404.php

Options +FollowSymLinks -MultiViews
RewriteEngine On
RewriteBase /

RewriteRule info info.php [NC,L]
RewriteRule work work.php [NC,L]
RewriteRule editorial editorial.php [NC,L]
RewriteRule curatorial curatorial.php [NC,L]
RewriteRule educational educational.php [NC,L]

<IfModule mod_rewrite.c>  
    RewriteEngine on  
    RewriteRule /([a-zA-Z0-9-/]+)$ /o.php?s=$1 [L]
</IfModule>

Any idea?

Raul Serrano

Raul Serrano 0 points

  • 4 years ago

Try adding this before the final RewriteRule:

RewriteCond %{REQUEST_URI} !^/perch

Thanks Mike, it works.

But for some reason, now it's giving me a 404 when I go into blog post's ... (even if I don't put your code...)

How could I debug this?

At a guess it might be your post page path in Settings. This is from the docs:

On the Settings page in Perch, find “Blog post page path” in the Blog section. Set its value to:

/blog/{postSlug}

Though you may need to do something different to suit your rewrite rule. The one in the docs example is different, and only for Blog posts, whereas yours looks to be site wide. There is more info here that might help:

https://docs.grabaperch.com/addons/blog/examples/clean-urls-perch/

My blog post src is /o.php so I believe htaccess is good on path...

Can you post what your blog URLs look like without the rewrite, and what you would like them to look like afterwards?

Sure https://mysite.com/o.php?s=this-is-my-slug to https://mysite.com/this-is-my-slug

Thanks for your time Mike