2

I was working on PHP project and making SEO friendly URL Like,

OLD : http://example.com/list_product?q=men-top-wear

New : http://example.com/list_product/men-top-wear

Here is my .htaccess file:

RewriteEngine on
Options -MultiViews

RewriteCond %{ENV:REDIRECT_STATUS} ^$
RewriteCond %{QUERY_STRING} ^q=(.*)$
RewriteRule ^list_product$ /list_product/%1? [R=301,L]


RewriteRule ^list_product/(.*)$ list_product.php?q=$1 [L]


RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^(.*?)/?$ /$1.php [NC,L]

It's working well but my link path has been changed to: http://example.com/list_product/images/logo.png

But I need this to be: http://example.com/images/logo.png

It adds list_product, but it's not working. Does anyone know why this is happening?

1
  • Whilst the linked question deals with missing CSS, the underlying problem (and resolution) is exactly the same... using relative URL-paths to your static resources.
    – MrWhite
    Jan 14, 2021 at 10:30

0

Browse other questions tagged or ask your own question.