1

i have use this for url rewrite

old url

   http://localhost/project/productSearch?id_category=7&id_size=23&id_colour=89 


    Options +FollowSymLinks -MultiViews
    # Turn mod_rewrite on
    RewriteEngine On

    RewriteRule productSearch/(\d+)/(\d+)/(\d+)$ productSearch.php?id_category=$1&id_size=$2&id_colour=$3 [L]

    ## hide .php extension snippet
    # To externally redirect /dir/foo.php to /dir/foo
    RewriteCond %{THE_REQUEST} \s([^.]+)\.php [NC]
    RewriteRule ^ %1 [R,L]

    # To internally forward /dir/foo to /dir/foo.php
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME}.php -f
    RewriteRule ^(.+?)/?$ $1.php [L]

now new url

           http://localhost/project/productSearch/7/23/89

But images,css.jqyery not loading on this page

Any Idea?

1 Answer 1

2

Your page at URL

http://localhost/project/productSearch/7/23/89

Gets rewritten to

http://localhost/project/productSearch?id_category=7&id_size=23&id_colour=89

Because of that all resource reference URLs point to wrong location now. You have to change the resource reference URLs to match the new page URL (post rewrite URL).

For example - if you had referred to an image in the earlier case with URL

<img src="../../../../images/image.png">

Now it will be

<img src="../images/image.png">
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.