Welcome to WebmasterWorld Guest from 54.160.131.144

Forum Moderators: Ocean10000 & incrediBILL & phranque

Message Too Old, No Replies

Need some help with bad flag delimiters

500 error

     

takaharu

3:15 pm on Apr 9, 2014 (gmt 0)

10+ Year Member



Hi everybody,

I am trying to install as script but to no avail. The error shows me the bad flag error. Is there someone who can take a look at it and help me out. I am a total noob when it comes to htaccess

Here is the code

# Turn off directory browsing
# Options -Indexes # Start the rewrite engine
RewriteEngine On # Make sure the user included www.
RewriteCond %{HTTP_HOST} ^subdomain.mydomain.com
RewriteRule ^(.*)$ http://www.subdomain.mydomain.com/$1 [r=301,L] # Compress the stylesheet
RewriteRule ^([^/]+).css$ classes/CompressStyles.php?sheet=$1 # Give pages pretty URLs
RewriteRule ^([0-9a-zA-Z\-]+)$ $1.php # Lame and Juicy buttons
RewriteRule ^([0-9a-zA-Z\-\\/]*)lame/([0-9]+)$ rate.php?value=-1&secretID=$2
RewriteRule ^([0-9a-zA-Z\-\\/]*)juicy/([0-9]+)$ rate.php?value=1&secretID=$2

# View comments
RewriteRule ^view/([0-9]+)$ comments.php?secretID=$1

# Delete comment
RewriteRule ^([0-9a-zA-Z\-\\/]*)delete-comment/([0-9]+)$ delete-comment.php?commentID=$2 # Delete entry
RewriteRule ^([0-9a-zA-Z\-\\/]*)delete-entry/([0-9]+)$ delete-entry.php?secretID=$2

# Edit entry
RewriteRule ^([0-9a-zA-Z\-\\/]*)edit-entry/([0-9]+)$ edit-entry.php?secretID=$2

# View category
RewriteRule ^view/([a-zA-Z\-]+)$ view-category.php?category=$1

# Pagination
RewriteRule ^([0-9a-zA-Z\-]+)/page([0-9]+)$ $1.php?page=$2
RewriteRule ^view/([0-9\-]+)/page([0-9]+)$ comments.php?secretID=$1&page=$2
RewriteRule ^view/([a-zA-Z\-]+)/page([0-9]+)$ view-category.php?category=$1&page=$2
RewriteRule ^page([0-9]+) index.php?page=$1
RewriteRule ^search/([0-9a-zA-Z\-\%\+]+)/page([0-9]+)$ search.php?query=$1&page=$2

# Secret submission
RewriteRule ^thank-you upcoming.php?submitted=true

# Admin Page
RewriteRule ^([0-9a-zA-Z\-\\/]*)admin admin/index.php

# Button clicking
RewriteRule ^images/buttons/([0-9a-zA-Z\-]+).png$ classes/Button.php?text=$1

# Mask all XML files as PHP pages
RewriteRule ^(.+).xml $1.php

# Page not found
ErrorDocument 404 /page-not-found


Thanks a lot for your time

phranque

6:22 pm on Apr 9, 2014 (gmt 0)

WebmasterWorld Administrator phranque is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month



The error shows me the bad flag error.


where are you seeing this error?

takaharu

8:22 pm on Apr 9, 2014 (gmt 0)

10+ Year Member



In the error log

not2easy

8:31 pm on Apr 9, 2014 (gmt 0)

WebmasterWorld Administrator 5+ Year Member Top Contributors Of The Month



The list posted here does not show any flags, that is probably one of the problems, but you say you are trying to run this as a script, so maybe you have something else to set a default? Just wild guessing. It helps to get info about other environment variables that are involved.

[r=301,L] is the only flag I see and only affects one rule. The default redirect is a 302, so if you want 301 you need to add a flag like the one shown where it results in a redirect.

BTW, for your own future updates, it is best to have your commented lines on their own line and to leave a space between rules so your file is easier to read - unless your script requires this format. It would look like this:

RewriteRule ^(.*)$ http: //www.subdomain.example.com/$1 [r=301,L]

# Compress the stylesheet
RewriteRule ^([^/]+).css$ classes/CompressStyles.php?sheet=$1

# Give pages pretty URLs
RewriteRule ^([0-9a-zA-Z\-]+)$ $1.php

# Lame and Juicy buttons
RewriteRule ^([0-9a-zA-Z\-\\/]*)lame/([0-9]+)$ rate.php?value=-1&secretID=$2

(Please ignore the extra space in the first rule listed - done to keep it from linking to an error)

lucy24

9:31 pm on Apr 9, 2014 (gmt 0)

WebmasterWorld Senior Member lucy24 is a WebmasterWorld Top Contributor of All Time Top Contributors Of The Month



it is best to have your commented lines on their own line

That's what's triggering the (slightly misleading) "bad flag" error lines. Apache expects to find a flag in this location, and instead finds a #.

Been there. Done that.