Jump to content
BandonRandon

.htaccess Rewrite Error

Recommended Posts

I don't know if this is the place to put this thread but i was wondering if someone could help me solve my .htaccess error. when i try to add a redirect using the cpanel it gives me this error:

Apache detected an error in the Rewrite config.

 

Syntax error on line 15 of /home/[username]/public_html/.htaccess.[random string]:

RewriteRule: bad flag delimiters

 

Please try again.

 

Here is what my .htaccess file looks like:

RewriteEngine On

RewriteRule ^css/(.*.\css) /combine.\php?type=css&files=$1

RewriteRule ^javascript/(.*.\js) /combine.\php?type=javascript&files=$1

Share this post


Link to post
Share on other sites

Welcome to the forums BrandonRandon :)

 

What do you want to do with the redirect ? Just a redirect of a single file ? Or folder ?

 

The error seems a little odd - in that it says an error on line 15 of the .htaccess, but the .htaccess you show is only 3 lines long. Is there anything else further down ?

 

I'd suggest opening a ticket at the help desk - and we'll take a closer look at it for you.

Share this post


Link to post
Share on other sites

The file is actually much larger than the 3 lines shown. The last 3 lines are 14,15, and 16 which is where the error was occurring. I was/am hoping it's an error with a misplaced escape. what combine.php does is compresses all .js and .css files into a zip archive then access them when it needs them. This is to increase page load.

 

As Far as what i would like to do i was just trying to enable a simply redirect of the cache folder (the place the zip files go) to redirect to the home page. This would be mainly handy for security and just so people won't be in my cache folder.

 

Thank you for your suggestion of using the help desk the reason i didn't was becuse i don't think this is a "hosting" related issue just a "webmaster" issue.

 

I have include the whole .htaccess file this time however i'm not sure the lines are right becuse i choose to open it using notepad.

 

Thank you,

Brandon

 

# -FrontPage-

 

IndexIgnore .htaccess */.??* *~ *# */HEADER* */README* */_vti*

 

<Limit GET POST>

order deny,allow

deny from all

allow from all

</Limit>

<Limit PUT DELETE>

order deny,allow

deny from all

</Limit>

AuthName [site URL]

AuthUserFile /home/[username]/public_html/_vti_pvt/service.pwd

AuthGroupFile /home/[username]/public_html/_vti_pvt/service.grp

 

RewriteEngine On

RewriteRule ^css/(.*.\css) /combine.\php?type=css&files=$1

RewriteRule ^javascript/(.*.\js) /combine.\php?type=javascript&files=$1

Share this post


Link to post
Share on other sites

Those backslashes in your RewriteRules don't look right to me. If you're trying to escape the periods, then the backslash should go before them rather than after. Also, you don't need to escape the periods in the second part because you're not matching anything. Try this:

 

>RewriteEngine On
RewriteRule ^css/(.*\.css) /combine.php?type=css&files=$1
RewriteRule ^javascript/(.*\.js) /combine.php?type=javascript&files=$1

Share this post


Link to post
Share on other sites
Those backslashes in your RewriteRules don't look right to me. If you're trying to escape the periods, then the backslash should go before them rather than after. Also, you don't need to escape the periods in the second part because you're not matching anything. Try this:

 

>RewriteEngine On
RewriteRule ^css/(.*\.css) /combine.php?type=css&files=$1
RewriteRule ^javascript/(.*\.js) /combine.php?type=javascript&files=$1

 

Thanks for the reply! This is how the author of the script originally had the .httpaccess file set up. See the original script here.

 

This is a wierd issue for me.

 

Thanks, Brandon

 

And thanks for the welcome everyone!

Share this post


Link to post
Share on other sites

wow!

 

I found the error, It was that i was turning the rewrite engine on in 2 places! I feel a little silly now! Thanks everyone, it seams to be working fine now!

 

Brandon

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...