A
A
Alex Mustdie2015-01-19 17:22:10
PHP
Alex Mustdie, 2015-01-19 17:22:10

How to customize regex with "/" in RewriteRule?

fbzdciZ.png
Good day!
I have been doing a project for 2 months, thinking that this task is easy to solve: after the address of my site (for example, site.com), the user writes a string (more precisely, url; it looks like this - site.com/my_url.com) and with the help of RewriteRule I I make this line a get-parameter (site.com/url.php?from=my_url.com). Everything goes well until the user writes a url like my_url.com/anything_else or http://my_url.com/anything_else, then all links to the included files in url.php are deformed (it was - resources/url.css, and became anything_else/ resources/url.css). How to fix it?
Thanks in advance!

Answer the question

In order to leave comments, you need to log in

2 answer(s)
O
Optimus, 2015-01-19
Pyan @marrk2

I also fiddled with htaccess until I started using routing, so my advice is to switch to routing and handle such exceptions yourself in the code

S
ShamblerR, 2015-02-24
@ShamblerR

can you exclude urls that have something behind my_url.com?

RewriteCond %{REQUEST_URI} !(/my_url.com)\/+*$ [NC]

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question