redirects to internal location using mod_rewrite without full path

Asked by:
bursainfo / 8 Points
Time:
2014-04-05 7:10 pm EST
Category:
Htaccess
Hits:
410
Hello
i'm trying to modify my .htaccess file to do some redirects for SEO purposes.
the problem is that I suspect only redirects to full path, include http:// is allowed in your site (and not relative redirect like the one I need:

RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_URI} ^/$
RewriteCond %{QUERY_STRING} ^_escaped_fragment_=/?(.*)$
RewriteRule ^(.*)$ /snapshots/%1.html [NC,L]

What can I do? I dont want to use:
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_URI} ^/$
RewriteCond %{QUERY_STRING} ^_escaped_fragment_=/?(.*)$
RewriteRule http://bursaisrael.info/snapshots/%1.html [NC,L]

because it change the path on the browser.

help needed,
thanks

To ask this user for more information, please first login.

To submit an answer, please login.

using the rewritebase as mentioned here:
http://www.webhostinghub.com/help/learn/website/drupal/install-drupal-on-temporary-url
also doesn't working


example:
RewriteEngine On
RewriteBase /~bursai5
RewriteCond %{REQUEST_URI} ^/$
RewriteCond %{QUERY_STRING} ^_escaped_fragment_=/?(.*)$
RewriteRule ^(.*)$ /snapshots/%1.html [NC,L]
bursainfo
8 Points
2014-04-05 08:15 pm EST

ANSWERS

0

johnpaulb-whh2
Staff
12,339 Points
2014-04-07 8:37 pm EST
Hello bursainfo,

Thank you for your question. Editing an .htaccess file can be difficult, since there are many different ways to code them.

You should not have to put the full path. For example, this should work:

RewriteEngine On
#RewriteBase /
RewriteCond %{HTTP_HOST} bursaisrael\.info
RewriteCond %{REQUEST_URI} ^/$
RewriteCond %{QUERY_STRING} ^_escaped_fragment_=/?(.*)$
RewriteRule ^(.*)$ /snapshots/%1.html [P,L]


The RewriteBase is probably not needed. I recommend testing it both ways to see if it is doing what you want.

Regarding the outdated article on testing Drupal with a temp URL: I notified our team's Drupal expert, that the article needs revisted, and it should he updated soon. However, in the meantime, you can install Drupal using Softaculous, then test it successfully on the Temp URL, without any coding changes necessary.

If you have any further questions, feel free to post them below.
Thank you,

-John-Paul

To submit a comment on this answer, please first login.

Hello john,
first I want to thank you for the reply.
The problem is still not solved -
I changed the .htaccess as you told me, and if I trying to go to
http://bursaisrael.info/?_escaped_fragment_=/main
I'm not getting to the snapshot file as the rule define.

IMPORTANT NOTE:
if I change:
RewriteRule ^(.*)$ /snapshots/%1.html [P,L]
to:
RewriteRule ^(.*)$ http://www.webhostinghub.com
it's actually redirect to webhostinghub.com...

What else could be the problem?
I leave the rule as you suggested me to do,
you can check yourself to see it's not working by visit:
www.bursaisrael.info/?_escaped_fragment_=/main

Thanks again.



bursainfo
8 Points

2014-04-11 1:18 am EST
Hello Bursainfo,

My systems team member and I spent a bit of time exploring your .htaccess rules. We even took them completely out and there was STILL something affecting the rewrite of the URL. We also took your rewrite rules and applied them to a separate website and it worked fine there. The .htaccess rules were restored to their original state after our testing.

My team mate (Jacob) believes the issue with the .htaccess rules has to do with your code. I noticed that you're running a few scripts in the top of your index file that has something to do with the URL. This, in my opinion is what is undermining your .htaccess rules from properly working. Unfortunately, this is above and beyond our normal support. We can help with typical application of .htaccess rules, but we cannot help with the code used in the index file that affects the mapping of the URL. Our apologies that we cannot provide a direct solution. You may need to consult with a web developer or the author of the jquery that you're using for further clarification.

Kindest regards,
Arnel C.
arnelc
17,314 Points
Staff
2014-04-11 3:19 am EST
Want to share this Question?

Related Articles

It looks like there are no related articles.
Would you like to ask a question about this page? If so, click the button below!
Need More Help?

Help Center Search

Current Customers

Email: support@WebHostingHub.com Ticket: Submit a Support Ticket
Call: 877-595-4HUB (4482)
757-416-6627 (Intl.)
Chat: Click To Chat Now

Ask the Community

Get help with your questions from our community of like-minded hosting users and Web Hosting Hub Staff.

Not a Customer?

Get web hosting from a company that is here to help.
}