Remove index.php in joomla - .htaccess

Hi I want to remove the index.php in my url. I tried alot of methods but none of them work. All of them reponse 500 error or could not find folder. any one can help me please. I just use normal joomla page dont have any thing special but removing index.php seem impossible to me
This is link to my website http://www.website.com/index.php/vn/
I am using joomla 2.5
Hi i fixed it. on some sever we have to do a little modified to the htaccess not just remove .txt and add . in front of it.
In my case, I need to add . in to the line "RewriteBase /" => "RewriteBase /."

What you are looking for is an option to turn on search engine friendly URLs. To completely get rid of "index.php" you need to be running Joomla on Apache server.
Rename "htaccess.txt" file in your root Joomla directory to ".htaccess".
Site > Global Configuration > Site > SEO Settings and set these settings:
Search Engine Friendly URLs - Yes
Use URL rewriting - Yes
Adds Suffix to URL - No
Unicode Aliases - No

on some sever we have to do a little modified to the htaccess not just remove .txt and add . in front of it.
In my case, I need to add . in to the line "RewriteBase /" => "RewriteBase /."

Related

I don't have .htaccess file for my magento installation. How to get .htaccess file to remove the "index.php" from URL

I don't have my .htaccess file for my magento installation which is by default present for all the fresh magento installation.
Now I have to remove "index.php" from my wesite url and found out htaccess file needs to be edited. But, there is no .htaccess file in my magento root folder.
Also, I have made a lot of changes to the website and don't want to do a fresh installation to get the .htaccess file.
Also, when I access my admin panel it also needs "index.php" in the URL.
Please, can someone help me with this.
To Remove the inde.php from the URL you need to enable Web Server Rewrites.
You can enable Web Server Rewrites suing below steps:
Login in Backend, from Top Navigation click on System >> Configuration >> Web
Select Use Web Server Rewrites to YES in Search Engines Optimization group.
If you need .htaccess file, you can donwload the compatible magento zip file and can use its .htaccess. There is no need to install magento for this.

Clean URL rewriting rule

right now my url looks like this:
http://domain.com/en/c/product%2C-product2%2C-product3/82
where last number is category numer.
And im trying to rewrite it and redirect user to url which should look this one:
http://domain.com/82/product-product2-product3
The clue is I want to hide "en/c/" part and clean url from commas and blank spaces. I'm completely green in rewriting.
Any ideas?
You can use these 2 rules in your root .htaccess for that:
RewriteEngine On
RewriteBase /
RewriteRule ^en/c/([^,\s]*)[,\s]+([^,\s]*)/(\d+)/?$ $3/$1$2 [NC,L,NE,R=302]
RewriteRule ^(en/c)/([^,\s]*)[,\s]+(.*)/(\d+)/?$ $1/$2$3/$4 [NC,L]
In order for this to work, we need to tell the server to internally redirect all requests for the URL "url1" to "url2.php". We want this to happen internally, because we don't want the URL in the browser's address bar to change.
To accomplish this, we need to first create a text document called ".htaccess" to contain our rules. It must be named exactly that (not ".htaccess.txt" or "rules.htaccess"). This would be placed in the root directory of the server (the same folder as "url2.php" in our example). There may already be an .htaccess file there, in which case we should edit that rather than overwrite it.
The .htaccess file is a configuration file for the server. If there are errors in the file, the server will display an error message (usually with an error code of "500").
If you are transferring the file to the server using FTP, you must make sure it is transferred using the ASCII mode, rather than BINARY. We use this file to perform 2 simple tasks in this instance - first, to tell Apache to turn on the rewrite engine, and second, to tell apache what rewriting rule we want it to use. We need to add the following to the file:
RewriteEngine On # Turn on the rewriting engine
RewriteRule ^url1/?$ url2.php [NC,L] # Handle requests for "url1"

How to change base_url in drupal 7, fail to find answer online

I am trying to change base_url on my drupal 7 website, but failed to do it and google a lot, still could not solve it .
I am running localhost/drupal "on my local server. but I want to run it like
" localhost ". ( sorry I have to get rid of http://, otherwise it doesnot let me post)
How to get rid of folder in the url. I know I need to change $base_url on sites/default/setting.php to
$base_url = 'localhost'; // NO trailing slash! ( sorry I have to get rid of http://, otherwise it doesnot let me post)
And in the .htaccess file I am so confused what should I change. People online have their own solution, some said they work , some could not . Could someone give me some suggesttion ?
I assume this has to do with where you have placed your files.
In your file system, remove the 'drupal' directory and place all the files within that at /var/www/html ... instead of /var/www/html/drupal, if that's how it is currently set up.
I feel your pain; I've had this trouble myself before and I believe I had to alter both the settings.php and the htaccess (but try one at a time to begin with). I'm fairly sure that the section below in your .htaccess is what needs changing (just remove the hash from in front of the RewriteBase line). If you're unsure of what you're doing, make a copy of your .htaccess as htaccess.txt and then you can always switch back over if things get nasty.
# Modify the RewriteBase if you are using Drupal in a subdirectory or in a
# VirtualDocumentRoot and the rewrite rules are not working properly.
# For example if your site is at http://example.com/drupal uncomment and
# modify the following line:
# RewriteBase /drupal
I just realised that what you need is a re-write rule in an .htaccess file within your root folder (not the one that's inside the drupal folder). First, undo any edits you've already made, then create an .htaccess file in the same folder that contains your drupal folder and in it, add:
RewriteEngine On
RewriteRule ^$ /drupal [L]
That should send any traffic from the root into the drupal file structure. If you get issues with strange css, or urls that include the /drupal path, you'll need to revisit the other options in the /drupal/.htaccess file and your settings.php file in order to get it all working correctly.
However, going down this route, you may as well just copy all the files and folders into the root directory anyway (as the first answer suggested), assuming you're not going to be running multiple sites. If you do want to be testing multiple sites, you can just change the RewriteRul above to whatever site directory you're wanting to test in future.

htaccess rewrite resulting in 500 Internal Server Error

I am trying to get pretty urls using htaccess for SLIR image resizing plugin.
I want to rewrite something like below:
Before Rewrite:
localhost/img/600x400/slider/image.jpg
After Rewrite
localhost/application/public/slir/index.php?r=slir&w=600&h=400&i=img/slider/image.jpg
But the following code is returning a 500 Internal server error...
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^(.*)/([0-9]{1,4})x([0-9]{1,4})/(.*)\.(gif|jpg|jpeg|png) application/public/slir/index.php?r=slir&w=$2&h=$3&i=$1/$4.$5 [NC,NE,QSA,L]
</IfModule>
Please help me.....
UPDATE
I thought it was a File Permissions issue...
so I checked all the related directories and files, surprisingly there were all 755/644.
Then I directly checked the /application/public/slir/index.php. It was not accessible.
I created another file named hello.php in the same slir directory and hello.php was accessible.
Then I moved the SLIR directory to the another folder named public. Here, both the index.php and hello.php were accessible.
After that, I moved SLIR directory to back to the original scripts folder. In scripts folder, hello.php is accessible but index.php is not accessible.
Now, Both files have same permissions and are in same folder.. I dont know what is happening here... :/ :/
Someone please help me......
In case anyone else is looking at this - the problem I found was these two lines in the htaccess file:
php_value auto_prepend_file none
&
php_value auto_append_file none
some servers don't allow them.
moving them to my php.ini file solved it for me:
auto-prepend-file = none
auto-append-file = none
That is probably because you are editing the .htaccess file with a Windows based editor like notepad. Notepad adds some characters to the file which you can't see, but they mess with the .htaccess. I recommend using an editor like Notepad++ and setting the mode to Unix, so it won't mess with the server..
Speaking technically that is because Linux and Windows have different type of EOL ( End Of Line ) so that notepad adds some characters to the end of every line to go to the next line, but Unix won't recognize them, because it has it's own type of EOL..
Slashes are normally forbidden in query strings, but you can enable them by setting
AllowEncodedSlashes directive.
You may also want your rewrite rule to use percent encoding for slashes (that is %2F) so after rewrite:
localhost/application/public/slir/index.php?r=slir&w=600&h=400&i=img%2Fslider%2Fimage.jpg
See also How do you configure apache php to accept slashes in query strings
Duplicate, phrased very differently:
Has anyone used Smart Image Resizer on subdomain sites?
The problem is the subdomain...

.htaccess redirect to subdirectory on Verio windows server

I've been trying to get a website up an running on my work's servers using Verio windows server 2003 gold and they've been quite useless when it comes to helping me out.
All I'm trying to do is set up a Wordpress installation, which they apparently require to be in a subdirectory. This is done and I have it in domain.com/wp ready to go. At this point they recommend that I use an .htaccess file to redirect to that url, so as they just sent me basically an "About .htaccess" link, that was of no help.
Did some searching, found a couple options like this one:
http://www.site5.com/blog/apache/htaccess/redirect-to-blog/20090427/
and nothing I use seems to work, not even as a straight redirect. Just gives me a "Directory Listing Denied - This Virtual Directory does not allow contents to be listed."
I do want to mention I did enable URL Rewrite for IIS via ISAPI_Rewrite 3 in the control panel.
As I mentioned Verio support is useless and I can't seem to find anything searching that seems to help my situation.
So pretty much what I need is domain.com/wp to rewrite as domain.com so all links centered around it do the same (ie domain.com/about domain.com/contact)
Any help? Thanks
If I understand you correct you need your Wordpress application to be available from the root of your web site instead of /wp/ folder? Then please try following .htaccess:
RewriteEngine on
RewriteRule ^(?!wp/)(.*) /wp/$1 [NC]
By the way I think you could try simply copying /wp/ folder content to the root folder.

Resources