Question: I am having the following two urls that give me some nasty 404 errors that I would like to fix by adding some rewrite rules to apache and I must recongnize that I don't understand regular expressions enough to be able to write the correct rules.

### FIRST URL

```
http://www.example.com/fincas-rusticas/finca-rustica_en_alacant-alicante/lalacanti/alicante/function.strtotime

```

Must redirect to the same url without /function.strtotime at the end.

### SECOND URL, nasty one.

> 
> <http://www.example.com/casas/casas_en_malaga/malaga/malaga/>
>   
> **Strict Standards**: Only variables should be passed by reference in **/var/www/vhosts/eldeposit.com/httpdocs/protected/helpers/Search.php** on line **1398**  
> /casas/casas\_en\_malaga/malaga/malaga/venta-vivienda-29-473-24693-0-0
> 
> 
> 

This one must remove the part with the strict standards error. I don't know if it even can be done with a regular expressions or I better program it in php

Answer: 
1) Use this rule -- it will remove `function.strtotime` from end of URL (by using 301 Permanent Redirect) regardless of how deep that part is in URL (i.e. it will work for `example.com/something/function.strtotime` as well as `example.com/one/two/three/function.strtotime`).

```
RewriteEngine On
RewriteBase /

RewriteRule ^(.*)function\.strtotime $1 [L,R=301]

```

2) This cannot be fixed by using .htaccess. It is error in your PHP code (sounds like you've passed value directly instead of assigning it to variable first and passing variable) and has to be fixed in PHP code.
For the first one you can do 

```
RewriteRule fincas-rusticas/finca-rustica_en_alacant-alicante/lalacanti/alicante/function.strtotime fincas-rusticas/finca-rustica_en_alacant-alicante/lalacanti/alicante/ [L]

```

For the second one, I must assume that this URL is already rewritten to something, since the strict standard error is a PHP error. This mean you address is somewhere processed. 

If the URL should be processed as by the script is it redirected to, I guess you can refer to : [Strict Standards: Only variables should be passed by reference](https://stackoverflow.com/questions/2354609/strict-standards-only-variables-should-be-passed-by-reference)

If the URL should yield a forbidden error, you can do 

```
RewriteRule casas/casas_en_malaga/malaga/malaga/ - [F]

```