.htaccess and SEO friendly urls

Hi everybody.
So I'm using a cde in .htaccess to remove php extension from the url:
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteCond %{REQUEST_URI} ^(.+)\.php$
RewriteRule (.*)\.php$ /$1 [R=301,L]

Open in new window

It works fine. But I have some dynamic url I want to make SEO compliant. For instance, I would like that

Open in new window


Open in new window

So I looked around and I found this to put in my .htaccess
RewriteCond %{THE_REQUEST} \s/vinos\.php\?v=(\w+)\s [NC]
RewriteRule ^ /vinos/%1? [R=301,L]
RewriteRule ^vinos/(\w+)$ /vinos.php?v=$1 [L]

Open in new window

With this the url is rewritten as expected but in the page which is open php just doesn't work. And all css is lost...
Any idea about how can I remove the extension from the simple page and make dynamic urls seo friendly?
Thank you in advance for any suggestion :)
LVL 32
Marco GasiFreelancerAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

David S.Consultant & Challenge SubduerCommented:
Well using that widely used technique for making user-friendly URLs effectively makes virtual directories, so you need to adjust file paths to allow for it. You can use root-relative URLs (for example "/path/to/style.css" instead of "path/to/style.css") or full URLs (the protocol isn't required though, as in the url would be like "//example.com/path/to/style.css").

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Marco GasiFreelancerAuthor Commented:
Thank you David, it works just fine! I'm going to open a new question about a consequence of this tecnique and I'll post the link here.
Thank you again.
Marco GasiFreelancerAuthor Commented:
Thanks and thanks again :)
Marco GasiFreelancerAuthor Commented:
No new question, I solved it by myself. I already thanked you? :D
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Web Development

From novice to tech pro — start learning today.