.htaccess保存不存在的URL

Is there a way to save the not existing url?

Lets say i go to:

www.domain.com/channel/abcd1234/

The folder abcd1234 doesn't exitst so you will be redirected to:

www.domain.com/channel/error/

Is there a way to save the first url? and getting it on the error page in a php variable?

<ifmodule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule (.*) http://domain/channel/error/ [R=301,L]
</ifmodule>

Instead of your rewrite rule you should use:

ErrorDocument 404 /channel/error/

Original 404 URL will be available to you as $_SERVER['REQUEST_URI']

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^([^/]+)$ $1.php [L]

replace by it.i wish it help you