Question

I have done this: http://rubular.com/r/AHI15Tb4ju, and it match the second url (http://gamempire.localhost.it/news/tomb-pc), but I want to exclude that url and match everything that do not have the word "news/" inside (but at the same time end in the way that I have specified).

How to do that? Basically, i want to match only the third url (http://gamempire.localhost.it/tomb-pc).

Thanks!

Pas de solution correcte

Autres conseils

You can use a rule like this:

RewriteEngine On

RewriteCond %{REQUEST_URI} !/news/
RewriteRule -(?:pc|ps2|ps3|ps4|xbox-360|xbox-one|xbox|wii-u|wii|psp|ps-vita|ds|3ds|iphone|ipad|android|playstation)(.*)$ / [L,R]

Since I didn't know any action part I just redirected these matching URI patterns to / that you can change according to your need.

Try using this:

^((?!news).)*-(?:pc|ps2|ps3|ps4|xbox-360|xbox-one|xbox|wii-u|wii|psp|ps-vita|ds|3ds|iphone|ipad|android|playstation)(.*)$

It should be noted that I tried to modify your original pattern as little as possible, assuming you also needed the (.*) at the end even though it appears that this is unnecessary for your purposes, and would match strings such as "http://gamempire.localhost-pc.it/tomb" and "http://-pcgamempire.localhost.it/tomb".

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top