I cannot get my rewrite map to work. I have read a lot of pages on this and yet can’t figure out how. I have a feeling my rewritecond may be wrong. So some tips would be helpful.
I have the following in my httpd.conf and took an apache restart
This is where I believe you’re confusing mod_rewrite. IMHO, you don’t need the RewriteCond. Remember, the second $1 in your redirection is supposed to be the not_found script. These errors are likely to be your problem.
<IfModule mod_rewrite.c>
[indent][color=RED][standard rant #4][indent]The definition of insanity is to repeatedly do the same thing expecting a different result. Asking Apache to confirm the existence of ANY module with an <IfModule> ... </IfModule> wrapper is the same thing in the webmaster world. DON'T ACT INSANE! If you don't know whether a module is enabled, run the test ONCE (without the wrapper) then delete it permanently as it is EXTREMELY wasteful of Apache's resources (and should NEVER be allowed on a shared server).[/indent][/standard rant #4][/color]
For what it's worth, my opinion is that ANY abuse of the server is unacceptable, moreso when it's repeated multiple times for every request being made of the server (which should be in the thousands if not hundreds of thousands).[/indent]
RewriteEngine On
RewriteRule [^/]+/.+-([\\d]+)/p([\\d]+)/ showthread.php?t=$1&page=$2 [NC,L]
RewriteRule [^/]+/.+-([\\d]+)/ showthread.php?t=$1 [NC,L]
[indent]Linux is case sensitive (for path/file, not domains) so the No Case flag can cause you to match unacceptable content. You're not specifying in your regex other than "p" and digits so I have to wonder why NC was included.[/indent]
Options +FollowSymlinks
rewritecond %{http_host} ^domain[size=6]\\[/size].com [nc]
rewriterule ^(.*)$ http://www.domain.com/$1 [r=301,nc]
RewriteCond ${ErrorMap:$1|NOT_FOUND} !NOT_FOUND
RewriteRule ^(.*)$ ${ErrorMap:$1|$1} [R=301]
[indent]Same comment as above.[/indent]
</IfModule>
[indent]Same comment as above.[/indent]
Sorry I could not reply any sooner as my laptop crashed and I could not make any changes to the config. I implemented most of your advice except for NC for now. I will look into it after I am done with this setup.
Loopy code is generally caused by the inappropriate use of (.*).
[standard rant #1][indent]The use of “lazy regex,” specifically the :kaioken: EVERYTHING :kaioken: atom, (.*), and its close relatives, is the NUMBER ONE coding error of newbies BECAUSE it is “greedy.” Unless you provide an “exit” from your redirection, you will ALWAYS end up in a loop![/indent][/standard rant #1]
If you would like more (better) comments, please display your mod_rewrite code and the test (and destination) URIs.
You might benefit from reading the mod_rewrite tutorial linked in my signature as it contains explanations and sample code. It’s helped may members and should help you, too.
# Mod_security can interfere with uploading of content such as attachments. If you
# cannot attach files, remove the "#" from the lines below.
#<IfModule mod_security.c>
# SecFilterEngine Off
# SecFilterScanPOST Off
#</IfModule>
ErrorDocument 401 default
ErrorDocument 403 default
ErrorDocument 404 default
ErrorDocument 500 default
RewriteEngine On
RewriteRule [^/]+/.+-([\\d]+)/p([\\d]+)/ showthread.php?t=$1&page=$2 [NC,L]
RewriteRule [^/]+/.+-([\\d]+)/ showthread.php?t=$1 [NC,L]
rewriterule ^(.*) ${ErrorMap:$1|$1} [R=301]
# If you are having problems with the rewrite rules, remove the "#" from the
# line that begins "RewriteBase" below. You will also have to change the path
# of the rewrite to reflect the path to your XenForo installation.
#RewriteBase /xenforo
# This line may be needed to enable WebDAV editing with PHP as a CGI.
#RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
Options +FollowSymlinks
rewritecond %{http_host} ^domain.com [nc]
rewriterule ^(.*)$ http://www.domain.com/$1 [r=301,nc]