PDA

View Full Version : issues with .htaccess making page break


deafboyzaudio
03-21-2013, 03:35 AM
I have a folder named store that I am no longer allowing access to. (pulled the store offline) I want people to be redirected to a under construction page when they try to access ANY page in the store folder.

ex: mysite.com/store/cart -----> mysite.com/store/underConstruction

or mysite.com/store/product_results -----> mysite.com/store/underConstruction.


ok i have this in my htaccess file RewriteBase /
RewriteRule ^. http://www.deafboyzaudio.com/store? [R=301,L]and the rest of it in its entirety
RewriteEngine on

RewriteBase /
RewriteRule ^. http://www.deafboyzaudio.com/store? [R=301,L]

Redirect /store/users_Registration.php http://www.deafboyzaudio.com/videos/login
Redirect /store/users_LogIn.php http://www.deafboyzaudio.com/videos/login
RewriteRule ^checkout?$ checkout.php [L]
RewriteRule ^products_results?$ Products_Results.php [L]
RewriteRule ^products_search?$ Products_Search.php [L]
RewriteRule ^shipping?$ Shipping.php [L]
RewriteRule ^cart?$ cart.php [L]
RewriteRule ^ordering?$ Ordering.php [L]
RewriteRule ^orders_history?$ orders_History.php [L]
RewriteRule ^returns?$ Returns.php [L]
RewriteRule ^store?$ index.php [L]The problem is with this line RewriteRule ^. http://www.deafboyzaudio.com/store? [R=301,L]


those 2 lines in the top code box DO work for my purpose, but for some reason my root index page, not even in the store folder where i have this htaccess file gets completely broken and the styling and layout is waaaayyyy messed up, removing that line of code fixes it.

that even confuses me as this .htaccess is stored in the store folder and the page that is breaking is one level above that (root folder)

does anyone have a redirect code that works, or maybe help to fix this one, i have scoured the interrnet for hours and this is the only one that works, but it breaks my root homepage.


thank you!!!

Ricky55
03-23-2013, 11:28 AM
You should only need this code to achieve what you want. Works for me anyway. Obviously change the part that points to your under construction. This can be anywhere just not in the store folder.


<IfModule mod_rewrite.c>
RewriteEngine on
Redirect 301 /store/ http://example.com/path/under-construction.html
</IfModule>

deafboyzaudio
03-24-2013, 03:10 AM
Thanks for the reply Ricky.
ok this is what i have

RewriteEngine on

<IfModule mod_rewrite.c>
Redirect 301 /store/ http://www.deafboyzaudio.com/underConstruction.php
</IfModule>

and it works beautifully for going to www.deafboyzaudio.com/store. but for examply when i try to go to www.deafboyzaudio.com/store/cart i get this
http://www.deafboyzaudio.com/underConstruction.phpcart and of course a 'not found error' as that page doesnt exist.

it is appendending the url of the page it is supposed to be redirected to inbetween the "store/" in the previous url and the specific page i was requesting in the store folder.

is there a way to fix this? I left it up as is so you can check it if you would like at www.deafboyzaudio.com/store/cart

Ricky55
03-25-2013, 12:50 PM
Beyond my basic knowledge of htaccess I'm afraid. Its not far away though. I've asked over on StackOverFlow for you I'll let you know when I have an answer as I wouldn't mind knowing myself how to do this.

deafboyzaudio
03-25-2013, 08:38 PM
ok thanks man. I had found a convo regarding this on stack overflow i believe, cant find it now though, ha. But i could not get it to work as I wanted it to.

I feel like this would be really useful to do.

edbr
03-26-2013, 05:22 AM
RewriteRule ^store/(.*) http://www.deafboyzaudio.com/store? [R=301,L] if not in root of directory

i think anyway

Ricky55
03-27-2013, 03:01 PM
Full code mate


Options +FollowSymLinks
RewriteEngine on
RewriteRule ^store.*$ http://domain.com/path/under-construction.html[r=301,L]

deafboyzaudio
04-02-2013, 02:10 AM
Full code mate


Options +FollowSymLinks
RewriteEngine on
RewriteRule ^store.*$ http://domain.com/path/under-construction.html[r=301,L]



sorry for the delayed response! I get a 500 internal server error with that. the exact code is:
Options +FollowSymLinks
RewriteRule ^store.*$ http://www.deafboyzaudio.com/underConstruction.php[r=301,L]


rewriteEngine on is already called earlier in the .htaccess file.

I also found the post on stack overflow that is exactly what i am trying to do.

http://stackoverflow.com/questions/10642602/htacess-redirect-directory-to-a-single-page

but I cant get that to work either, very frustrating

deafboyzaudio
04-08-2013, 06:51 PM
Full code mate


Options +FollowSymLinks
RewriteEngine on
RewriteRule ^store.*$ http://domain.com/path/under-construction.html[r=301,L]


Thanks, and that link in my previous post is supposed to work as well. I have a feeling I cant get them to because of the existing .htaccess that came with vidiscript. It has TONS of seo and redirect "pretty url" stuff. I found a good tut on .htaccess if anyone else wants to learn more. I will study it and get back on with what i found
http://www.javascriptkit.com/howto/htaccess.shtml