3

RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.+)/$ /$1 [L,R=301] The regex ^(.+)/$ only matches URLs that end with a slash, so it matches /pagename.html/, but not /pagename.html/randomchars. However, to avoid matching the slash anywhere in the URL (you probably have multiple path segments in some of your URLs) you can specifically match the file ...


2

To my mind, there are two ways to approach this problem. The first way is what you're already doing, i.e., trying to do everything with mod_rewrite. This is totally fine for small, simple projects but if your project grows in size or complexity, it can become unwieldy to develop and maintain. The second option is to have your application manage the rewrites, ...


2

RewriteRule ^show_c.html/([-\w]+)$ show_c.php?cat=${catcolors:$1} [L] The regex [-\w]+ does not match *, so the pattern never matches the requested URL-path and the value is never looked up in the rewrite map. Try the following instead: RewriteRule ^show_c\.html/([-*\w]+)$ show_c.php?cat=${catcolors:$1} [L] The literal * does not need to be backslash ...


1

You need to make the mobile and desktop URLs different to resolve this ambiguity. Perhaps with an /m/ (mobile) and/or /d/ (desktop) prefix? For example, /m/Contact/Location/ for your mobile site and the default /Contact/Location/ for the desktop site. However, since there is a strong preference for "mobile-first" these days, maybe this should be /d/...


1

The problem would seem to be that you are using a relative client-side URL to make the AJAX request and since you are using a URL at a different path depth fetch_data_p.php is not found. The AJAX request for fetch_data_p.php is relative to the visible URL in the browser. You need to make this URL root-relative (starting with a slash). eg. /photo_gallery/...


Only top voted, non community-wiki answers of a minimum length are eligible