Hi,
I have configured my Blog on http://blog.example.com. For this I have an Apache Conf file which direct the user to /blog directory.
I have two major issues:
1.) After installation, when I try to open admin panel from http://blog.example.com/admin/login, it throws 500 Internal Server Error. It seems the rewrite engine is not properly coded in the .htaccess file.
Also when I try to open the admin link, it takes me to: http://www.example.com/admin/login in place of http://blog.example.com/admin/login. This is bound to throw an error.
2.) When I open the site, http://blog.example.com, it opens normally, but when I click on the default 1st blog, again the Server throw 500 Internal Error and takes me to http://www.example.com/posts/my-blog in place of http://blog.example.com/posts/my-blog.
I think it has something to do with .htaccess file which sends rewrite information to server, which is incorrect.
Can you please advice what should be the edit for: <pre> RewriteRule ^(.*)$ index.php/$1 [L] </pre> so that I can remove index.php from the URL as well as keep the link to http://blog.example.com/ while browsing the blog?
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
Hi
My .htaccess file which is placed in root of my blog installation which is working to an extent now: <pre> #Options -indexes
<IfModule mod_rewrite.c> RewriteEngine On RewriteBase /
# Allow any files or directories that exist to be displayed directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# Rewrite all other URLs to index.php/URL
RewriteRule ^(([a-zA-Z0-9_-]+)(/([a-zA-Z0-9_-]*))?)$ index.php?uri=$1&rewrite=page [L,QSA]
</IfModule>
<IfModule !mod_rewrite.c> ErrorDocument 404 index.php </IfModule> </pre> Even though I’m now able to stay on http://blog.example.com/ but I get errors:
1.) While I’m inside my blog’s admin panel and trying to edit configuration. Now when I try to configure any setting, server throws “URL not found on sever” error.
2.) When I try to open admin panel from:
it throws an error saying file not found. But interestingly, when i explicitly put a “/” in the end like:
http://blog.example.som/admin/
it takes me to admin panel
3.) Point to be noted, that I have another .htaccess file sitting on the root of http://www.example.com. It means that I have two .htaccess files. One is sitting on the root of “example.com/” and other sitting on “example.com/blog/”. I don’t know to what extent .htaccess file of example.com would have effect on “blog.example.com” (read as example.com/blog/).
It seems I’m nearing a solution, but not yet done! Now I’m stuck. Neither I’m able to create any new blog as admin nor I’m able make any changes into admin configuration. Any guesses?
Let’s start simple:
in your apache config (/etc/httpd/conf/httpd.conf or /etc/apache2/apache2.conf), do you have this uncommented: <pre> NameVirtualHost *:80 </pre> If not, uncomment that, and restart httpd
Next, most blogging software won’t allow multiple domains in one folder. You’ll need a separate folder per domain/sub-domain. If you’re not doing this, you will need to separarate that.
Almost done. Let’s go back to the apache config (Look at my 2nd line for the file again)
Do you have something like this for your vhost: <pre> AllowOverride All </pre> or is it something like this: <pre> AllowOverride None </pre> If the latter, it won’t work, and you’ll need to change it (This doesn’t apply to the cgi-bin or error folders, just your document root).
Next to last: do you have mod_rewrite enabled? For Ubuntu, you would run this: <pre> a2enmod rewrite; service apache2 reload </pre> Finally: do you have the permission set for the web user (apache/www-data) to have read access to your .htaccess file?
If you’re unsure of any of the answers to these questions, just let me know.
Jon
Hi
Checklist:
1.) Apache2.conf (CHECK) 2.) AllowOverrideAll (CHECK) 3.) mod_rewrite enables (CHECK)
Pls advice what should be the correct code in .htaccess file. In my .htaccess file I have a code <pre> RewriteRule ^(.*)$ index.php/$1 [L] </pre> that Rewrites URL and remove index.php.
But that’s the catch. Once it removes index.php, it also remove any subdomain identifier take takes it back to “www”.
Pls advice correct code for .htaccess for subdomain redirection…
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.