2011-03-06 18 views
30

मैं अपने परीक्षण वातावरण पर काम करने वाली वेबसाइट प्राप्त करने की कोशिश कर रहा हूं, लेकिन किसी भी तरह से यह काम नहीं कर रहा है। मैं सामान्य इंडेक्स पेज लोड कर सकता हूं, लेकिन जब मैं/पेज/टेस्ट एक्सेस करना चाहता हूं तो यह एक त्रुटि फेंकता है कि पेज मौजूद नहीं है। मेरे लॉग कहते हैं:अपाचे सर्वर अनदेखा करता है। Htaccess

File does not exist: /home/page_url/www/page

कौन वास्तव में सच है, लेकिन यह मेरी पृष्ठ नियंत्रक के बजाय मिला है और परीक्षा पद्धति लोड करना चाहिए।

मेरे .htaccess लगता है:

<VirtualHost *:80> 
    ServerName page_url 
    Include /etc/apache2/vhosts.d/vhco.include 
    DocumentRoot "/home/page_url/www/" 

    # Logging 
    CustomLog /var/log/apache2/access_log common 
    ErrorLog /var/log/apache2/error_log 

    # This should be changed to whatever you set DocumentRoot to. 
    <Directory "/home/page_url/www/"> 
     # Possible values for the Options directive are "None", "All", 
     # or any combination of: 
     # Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews 
     # 
     # Note that "MultiViews" must be named *explicitly* --- "Options All" 
     # doesn't give it to you. 
     # 
     # The Options directive is both complicated and important. Please see 
     # http://httpd.apache.org/docs/2.2/mod/core.html#options 
     # for more information. 
     Options Indexes FollowSymLinks 

     # AllowOverride controls what directives may be placed in .htaccess files. 
     # It can be "All", "None", or any combination of the keywords: 
     # Options FileInfo AuthConfig Limit 
     AllowOverride All 

     # Controls who can get stuff from this server. 
     Order allow,deny 
     Allow from All 
    </Directory> 

    <IfModule alias_module> 
     # Redirect: Allows you to tell clients about documents that used to 
     # exist in your server's namespace, but do not anymore. The client 
     # will make a new request for the document at its new location. 
     # Example: 
     # Redirect permanent /foo http://www.example.com/bar 

     # Alias: Maps web paths into filesystem paths and is used to 
     # access content that does not live under the DocumentRoot. 
     # Example: 
     # Alias /webpath /full/filesystem/path 
     # 
     # If you include a trailing/on /webpath then the server will 
     # require it to be present in the URL. You will also likely 
     # need to provide a <Directory> section to allow access to 
     # the filesystem path. 

     # ScriptAlias: This controls which directories contain server scripts. 
     # ScriptAliases are essentially the same as Aliases, except that 
     # documents in the target directory are treated as applications and 
     # run by the server when requested rather than as documents sent to the 
     # client. The same rules about trailing "/" apply to ScriptAlias 
     # directives as to Alias. 
     ScriptAlias /cgi-bin/ "/var/www/localhost/cgi-bin/" 
    </IfModule> 

    # "/var/www/localhost/cgi-bin" should be changed to whatever your ScriptAliased 
    # CGI directory exists, if you have that configured. 
    <Directory "/home/page_url/www/"> 
     AllowOverride None 
     Options None 
     Order allow,deny 
     Allow from All 
    </Directory> 
</VirtualHost> 

मैं Gentoo उपयोग कर रहा हूँ: जैसे

# Turn on URL rewriting 
RewriteEngine On 

# Installation directory 
RewriteBase/

# Protect hidden files from being viewed 
<Files .*> 
    Order Deny,Allow 
    Deny From All 
</Files> 

# Protect application and system files from being viewed 
RewriteRule ^(?:application|modules|system)\b.* /$0 [L] 

# 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 .* index.php/$0 [PT] 

मेरे vhost विन्यास लग रहा है।

किसी भी मदद की सराहना की जाएगी।

उत्तर

61
<Directory "/home/page_url/www/"> 
    AllowOverride None 

यह AllowOverride None पढ़े जाने से .htaccess फ़ाइलें अक्षम करता है। the manual देखें।

इसके अलावा, कृपया ध्यान रखें कि .htaccess फ़ाइलों के बारे में जादुई कुछ भी नहीं है। सर्वर कॉन्फ़िगरेशन तक पूर्ण पहुंच न होने के लिए वे एक कच्चे कामकाज हैं। वे सभी अपाचे कॉन्फ़िगरेशन का एक टुकड़ा हैं। यदि आपके पास सर्वर कॉन्फ़िगरेशन तक पूर्ण पहुंच है, तो आपको इस तरह की सामग्री को vhost कॉन्फ़िगरेशन में रखना चाहिए, .htaccess फ़ाइलों पर नहीं।

+1

'AllowOverride none' के साथ कॉन्फ़िगरेशन के लिए'/etc/apache2/sites-available' और '/ etc/apache2/apache2.conf' में जांचना सुनिश्चित करें। ऐसा करने से मुझे पूरी वेब बैठक के लिए अपने वेबपृष्ठ के एक वर्किंग वर्जन को प्रदर्शित करने से रोक दिया! –

+6

'ऑर्डर ओवरराइड ऑल' समस्या को हल करता है –

4

एक बात करता है, तो आपका रीराइट नियम अब भी काम नहीं करते याद रखें:

इसके अलावा ModRewrite मॉड्यूल सक्रिय करें! यह उबंटू में डिफ़ॉल्ट रूप से नहीं है।

+0

यह मेरी समस्या थी। मेरे पास मॉड्यूल सक्षम था लेकिन मेरी। Htaccess फ़ाइल में 'रिवाइटइंजिन ऑन' गायब था। एक और कॉन्फ़िगरेशन से कॉपी/पेस्ट को गड़बड़ करने के लिए मुझे यही मिलता है! – vaindil

10

जैसा कि जिम ने कहा, अगर आपके पास अपने सर्वर तक पूर्ण पहुंच है, तो आपको बस सर्वर कॉन्फ़िगरेशन फ़ाइलों में सबकुछ रखना चाहिए।

मैं यहां पहुंचा क्योंकि मैंने सोचा था कि मेरा सर्वर मेरी खुद की htaccess/सर्वर कॉन्फ़िगरेशन फ़ाइलों को अनदेखा कर रहा था। हालांकि, यह पता चला कि मेरे पास mod_expires और mod_rewrite अक्षम था। जब मैंने उन दोनों को देखा, तो सबकुछ फिर से काम कर रहा था जैसा इसे करना चाहिए।

आप उन्हें इन आदेशों को क्रियान्वित करने से सक्षम कर सकते हैं:

sudo a2enmod expires 
sudo a2enmod rewrite 

फिर अपाचे

service apache2 restart 

आशा इस कोई वहाँ बाहर में मदद करता है को पुनः आरंभ!

+0

धन्यवाद। mod rewrite पर्याप्त नहीं है, मुझे समय सीमा समाप्त करना पड़ा। –

+0

आपका स्वागत है! –

+1

मेरी इच्छा है कि मैं इसे +1 कर सकता हूं। धन्यवाद!!!! – ingernet

संबंधित मुद्दे