0
  1. this is the first time to me to rewrite url using .htaccess.
  2. when I rewrite the url my css was missing
  3. here is my code:

    RewriteEngine On
    
    RewriteBase /blog/
    
    RewriteCond %{REQUEST_FILENAME} !-d [NC]
    
    RewriteCond %{REQUEST_FILENAME} !-f [NC]
    
    RewriteRule ^([0-9]+)/([^/.]+)/?$ catview.php?ctid=$1&cet_slug=$2 [QSA,L]
    

I need the url: blog/9/iphone

It's working but missing css! Can anyone help me?

1 Answer 1

1

You can use following code of .htaccess by which you can acheive your requirement:

not rewrite css, js and images

RewriteCond %{REQUEST_URI} !\.(?:css|js|jpe?g|gif|png)$ [NC]
RewriteRule ^xyz/(.+)/(.+)/ abc.php?id=$1&name=$2 [L]

rewrite css, js and images, from root

RewriteRule ^xyz/[^/]+/[^/]+/(.+)$ $1  [L]
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.