I need to redirect all urls with dash to a specific page.
For example:
site.com/this-url to site.com/page.php?url=this-url
RewriteRule
RewriteRule ^(.+-.+)$ page.php?url=$1
just hang http. No response.
What is wrong and how it can be done?
I need to redirect all urls with dash to a specific page.
For example:
site.com/this-url to site.com/page.php?url=this-url
RewriteRule
RewriteRule ^(.+-.+)$ page.php?url=$1
just hang http. No response.
What is wrong and how it can be done?
Try this instead, you may have an infinite loop.
RewriteCond $0 !^page\.php
RewriteRule ^(.+-.+)?$ page.php?url=$1 [L,B,QSA]
Now:
QSA flags appends all the query parameters from the original request to the rewritten requestB flag escapes the backreference $1 so that it can safely be used as a query paramaterL flag is not strictly necessary, but avoids evaluating other rewrite rules when this one is matchedYou may also try this option:
RewriteCond %{REQUEST_URI} !^page\.php
RewriteRule - page.php?url=%{REQUEST_URI} [L,B,QSA]